@@ -17,6 +17,19 @@ public class Ui {
1717 "You are back in Normal Mode" ;
1818 public static final String DECK_WELCOME_LINE =
1919 "You are now in Deck Mode, editing: " ;
20+ public static final String GAME_WELCOME_MESSAGE =
21+ "Welcome to Game Mode!\n " + System .lineSeparator () +
22+ "In this mode, you test your knowledge against the flash cards in the deck.\n " +
23+ "Questions will be displayed in a randomised order. At each question, you can\n " +
24+ " 1. Try to attempt an answer at the question, by typing at the prompt\n " +
25+ " 2. Press <enter> (with an empty attempt if you want to do it in your head)\n " +
26+ "Then, our 'advanced' algorithms will check your answer and score your answer \n " +
27+ "(if any), and display the correct answer for you to check your answer against.\n " +
28+ "Finally, we will ask if you think you got it right. If you did not, the\n " +
29+ "question will be inserted back into the question pool, and you will get a \n " +
30+ "chance to attempt it again!\n " + System .lineSeparator () +
31+ "Press <enter> to begin. Type `help` for help. Have fun!\n " + System .lineSeparator () +
32+ "Game Mode is started for: " ;
2033 public static final String BYE_LINE =
2134 "Bye. Hope to see you again soon!" ;
2235 public static final String NOT_RECOGNISED_LINE =
@@ -60,9 +73,18 @@ public class Ui {
6073 "Question and answer updated." ;
6174 private static final String NO_UPDATE_LINE =
6275 "Original question and answer retained" ;
76+ private static final String INCLUDE_EXCLUDE_LINE =
77+ "Do you want to re-attempt this question later? " ;
78+ private static final String ATTEMPT_FEEDBACK_LINE =
79+ "The % match between your answer and the actual answer is:" ;
80+ private static final String ENTER_ATTEMPT_LINE =
81+ " Enter your attempt below (or `done`, `exit`, `help`):" ;
82+ private static final String DONE_GAME_LINE =
83+ "You have completed all the flash cards in this deck! Returning to Normal Mode..." ;
6384
6485 public static final String EXIT = "exit" ;
6586 public static final String EDIT = "edit" ;
87+ public static final String START = "start" ;
6688 public static final String DONE = "done" ;
6789 public static final String ADD = "add" ;
6890 public static final String CREATE = "create" ;
@@ -124,6 +146,14 @@ public static void printDeckPrompt(Deck deck) {
124146 System .out .print (" > " );
125147 }
126148
149+ /**
150+ * Displays the prompt for user input in Game Mode.
151+ */
152+ public static void printGamePrompt (Deck deck ) {
153+ System .out .println ("[Game - " + deck .getName () + "]" );
154+ System .out .print (" > " );
155+ }
156+
127157 /**
128158 * Displays the prompt for user input without specifying current mode.
129159 */
@@ -145,6 +175,13 @@ public static void printDeckWelcome(int index, Deck deck) {
145175 printMessage (DECK_WELCOME_LINE + "[" + index + "] " + deck .getName ());
146176 }
147177
178+ /**
179+ * Displays the welcome message for Game Mode.
180+ */
181+ public static void printGameWelcome (int index , Deck deck ) {
182+ printMessage (GAME_WELCOME_MESSAGE + "[" + index + "] " + deck .getName ());
183+ }
184+
148185 /**
149186 * Displays the greeting message.
150187 */
@@ -327,4 +364,28 @@ public static void printInvalidYorNResponse() {
327364 public static void printVersionNumber () {
328365 printMessage ("Version: " + VERSION_NUMBER );
329366 }
367+
368+ public static void printIncludeExcludeLine () {
369+ System .out .print (INCLUDE_EXCLUDE_LINE + YN_LINE + "\n " );
370+ printPrompt ();
371+ }
372+
373+ public static void printAttemptFeedback (double matchPercentage ) {
374+ System .out .println (String .format ("%s %.2f" , ATTEMPT_FEEDBACK_LINE , matchPercentage ));
375+ }
376+
377+ public static void printGameQuestion (String question ) {
378+ System .out .println ("Q: " + question );
379+ System .out .println (ENTER_ATTEMPT_LINE );
380+ printPrompt ();
381+ }
382+
383+ public static void printAnswerGameMode (String answer ) {
384+ System .out .println ("A: " + answer );
385+ }
386+
387+ public static void printDoneGameMessage () {
388+ System .out .println (DASH_LINES );
389+ System .out .println (DONE_GAME_LINE );
390+ }
330391}
0 commit comments