]> git.earman.xyz Git - sensor-watch.git/commitdiff
Hi-lo: Update face description
authorChris <chris.ellis.git.dev@gmail.com>
Sun, 9 Jul 2023 14:52:54 +0000 (15:52 +0100)
committerChris <chris.ellis.git.dev@gmail.com>
Sun, 23 Jul 2023 14:51:25 +0000 (15:51 +0100)
- Remove test code

movement/watch_faces/complication/higher_lower_game_face.c
movement/watch_faces/complication/higher_lower_game_face.h

index 1edcaa0265afa790a176bd63e6ce2e1b20ef0f4c..aed6eeef2a840edba3796351e32694955a02e686 100755 (executable)
  * SOFTWARE.\r
  */\r
 \r
-// TODO: Win animation?\r
-// TODO: Save highscore?\r
-// TODO: Add sounds?\r
-//       Add sound option\r
-// TODO: Flip board direction?\r
-\r
-// Future Ideas:\r
-// - Use lap indicator for larger score improvement?\r
-\r
 // Emulator only: need time() to seed the random number generator.\r
 #if __EMSCRIPTEN__\r
 #include <time.h>\r
@@ -43,7 +34,7 @@
 \r
 #define TITLE_TEXT "Hi-Lo"\r
 #define GAME_BOARD_SIZE 6\r
-#define MAX_BOARDS 3 //40\r
+#define MAX_BOARDS 40\r
 #define GUESSES_PER_SCREEN 5\r
 #define WIN_SCORE MAX_BOARDS * GUESSES_PER_SCREEN\r
 #define STATUS_DISPLAY_START 0\r
@@ -104,8 +95,7 @@ static void reset_board(bool first_round) {
     // Fill remainder of board\r
     for (size_t i = 1; i < GAME_BOARD_SIZE; ++i) {\r
         game_board[i] = (card_t) {\r
-                //.value = generate_random_number(MAX_CARD_VALUE - MIN_CARD_VALUE + 1) + MIN_CARD_VALUE,\r
-                .value = i + MIN_CARD_VALUE,\r
+                .value = generate_random_number(MAX_CARD_VALUE - MIN_CARD_VALUE + 1) + MIN_CARD_VALUE,\r
                 .revealed = false\r
         };\r
     }\r
@@ -129,7 +119,7 @@ static void set_segment_at_position(segment_t segment, uint8_t position) {
 }\r
 \r
 static void render_board_position(size_t board_position) {\r
-    size_t display_position = FLIP_BOARD_DIRECTION\r
+    const size_t display_position = FLIP_BOARD_DIRECTION\r
             ? BOARD_DISPLAY_START + board_position\r
             : BOARD_DISPLAY_END - board_position;\r
     const bool revealed = game_board[board_position].revealed;\r
@@ -371,4 +361,3 @@ void higher_lower_game_face_resign(movement_settings_t *settings, void *context)
 \r
     // handle any cleanup before your watch face goes off-screen.\r
 }\r
-\r
index 1cef05dc38393e7f47961472c473e4d054eaea77..d0936808a411188c63bb46185c6b9928ec7b88f1 100755 (executable)
 #include "movement.h"\r
 \r
 /*\r
- * A DESCRIPTION OF YOUR WATCH FACE\r
+ * Higher-Lower game face\r
+ * ======================\r
  *\r
- * and a description of how use it\r
+ * A game face based on the "higher-lower" card game where the objective is to correctly guess if the next card will\r
+ * be higher or lower than the last revealed cards.\r
  *\r
+ * Game Flow:\r
+ * - When the face is selected, the "Hi-Lo" "Title" screen will be displayed, and the status indicator will display "GA" for game\r
+ * - Pressing `ALARM` or `LIGHT` will start the game and proceed to the "Guessing" screen\r
+ *   - The first card will be revealed and the player must now make a guess\r
+ *   - A player can guess `Higher` by pressing the `LIGHT` button, and `Lower` by pressing the `ALARM` button\r
+ *   - The status indicator will show the result of the guess: HI (Higher), LO (Lower), or == (Equal)\r
+ *   - There are five guesses to make on each game screen, once the end of the screen is reached, a new screen\r
+ *     will be started, with the last revealed card carried over\r
+ *   - The number of completed screens is displayed in the top right (see Scoring)\r
+ * - If the player has guessed correctly, the score is updated and play continues (see Scoring)\r
+ * - If the player has guessed incorrectly, the status will change to GO (Game Over)\r
+ *   - The current card will be revealed\r
+ *   - Pressing `ALARM` or `LIGHT` will transition to the "Score" screen\r
+ * - If the game is won, the status indicator will display "WI" and the "Win" screen will be displayed\r
+ *   - Pressing `ALARM` or `LIGHT` will transition to the "Score" screen\r
+ * - The status indicator will change to "SC" when the final score is displayed\r
+ *   - The number of completed game screens will be displayed on using the first two digits\r
+ *   - The number of correct guesses will be displayed using the final three digits\r
+ *   - E.g. "13: 063" represents 13 completed screens, with 63 correct guesses\r
+ * - Pressing `ALARM` or `LIGHT` while on the "Score" screen will transition to back to the "Title" screen\r
+ *\r
+ * Scoring:\r
+ * - If the player guesses correctly (HI/LO) a point is gained\r
+ * - If the player guesses incorrectly the game ends\r
+ *   - Unless the revealed card is equal (==) to the last card, in which case play continues, but no point is gained\r
+ * - If the player completes 40 screens full of cards, the game ends and a win screen is displayed\r
+ *\r
+ * Misc:\r
+ * The face tries to remain true to the spirit of using "cards"; to cope with the display limitations I've arrived at\r
+ * the following mapping of card values to screen display, but am open to better suggestions:\r
+ *\r
+ * | Cards   |                          |\r
+ * |---------|--------------------------|\r
+ * | Value   |2|3|4|5|6|7|8|9|10|J|Q|K|A|\r
+ * | Display |2|3|4|5|6|7|8|9| 0|-|=|≡|H|\r
+ *\r
+ * The following may more legible choice:\r
+ * | Cards   |                          |\r
+ * |---------|--------------------------|\r
+ * | Value   |2|3|4|5|6|7|8|9|10|J|Q|K|A|\r
+ * | Display |0|1|2|3|4|5|6|7|8 |9|-|=|≡|\r
+ *\r
+ * Future Ideas:\r
+ * - Add sounds\r
+ * - Save/Display high score\r
+ * - Add a "Win" animation\r
+ * - Consider using lap indicator for larger score limit\r
  */\r
 \r
 typedef struct {\r
@@ -52,4 +101,3 @@ void higher_lower_game_face_resign(movement_settings_t *settings, void *context)
 })\r
 \r
 #endif // HIGHER_LOWER_GAME_FACE_H_\r
-\r