Skip to content

Commit

Permalink
Hi-lo: Update face description
Browse files Browse the repository at this point in the history
- Remove test code
  • Loading branch information
Chris-E-J-Ellis committed Jul 23, 2023
1 parent 739ad64 commit b147ac0
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 17 deletions.
17 changes: 3 additions & 14 deletions movement/watch_faces/complication/higher_lower_game_face.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@
* SOFTWARE.
*/

// TODO: Win animation?
// TODO: Save highscore?
// TODO: Add sounds?
// Add sound option
// TODO: Flip board direction?

// Future Ideas:
// - Use lap indicator for larger score improvement?

// Emulator only: need time() to seed the random number generator.
#if __EMSCRIPTEN__
#include <time.h>
Expand All @@ -43,7 +34,7 @@

#define TITLE_TEXT "Hi-Lo"
#define GAME_BOARD_SIZE 6
#define MAX_BOARDS 3 //40
#define MAX_BOARDS 40
#define GUESSES_PER_SCREEN 5
#define WIN_SCORE MAX_BOARDS * GUESSES_PER_SCREEN
#define STATUS_DISPLAY_START 0
Expand Down Expand Up @@ -104,8 +95,7 @@ static void reset_board(bool first_round) {
// Fill remainder of board
for (size_t i = 1; i < GAME_BOARD_SIZE; ++i) {
game_board[i] = (card_t) {
//.value = generate_random_number(MAX_CARD_VALUE - MIN_CARD_VALUE + 1) + MIN_CARD_VALUE,
.value = i + MIN_CARD_VALUE,
.value = generate_random_number(MAX_CARD_VALUE - MIN_CARD_VALUE + 1) + MIN_CARD_VALUE,
.revealed = false
};
}
Expand All @@ -129,7 +119,7 @@ static void set_segment_at_position(segment_t segment, uint8_t position) {
}

static void render_board_position(size_t board_position) {
size_t display_position = FLIP_BOARD_DIRECTION
const size_t display_position = FLIP_BOARD_DIRECTION
? BOARD_DISPLAY_START + board_position
: BOARD_DISPLAY_END - board_position;
const bool revealed = game_board[board_position].revealed;
Expand Down Expand Up @@ -371,4 +361,3 @@ void higher_lower_game_face_resign(movement_settings_t *settings, void *context)

// handle any cleanup before your watch face goes off-screen.
}

54 changes: 51 additions & 3 deletions movement/watch_faces/complication/higher_lower_game_face.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,59 @@
#include "movement.h"

/*
* A DESCRIPTION OF YOUR WATCH FACE
* Higher-Lower game face
* ======================
*
* and a description of how use it
* A game face based on the "higher-lower" card game where the objective is to correctly guess if the next card will
* be higher or lower than the last revealed cards.
*
* Game Flow:
* - When the face is selected, the "Hi-Lo" "Title" screen will be displayed, and the status indicator will display "GA" for game
* - Pressing `ALARM` or `LIGHT` will start the game and proceed to the "Guessing" screen
* - The first card will be revealed and the player must now make a guess
* - A player can guess `Higher` by pressing the `LIGHT` button, and `Lower` by pressing the `ALARM` button
* - The status indicator will show the result of the guess: HI (Higher), LO (Lower), or == (Equal)
* - There are five guesses to make on each game screen, once the end of the screen is reached, a new screen
* will be started, with the last revealed card carried over
* - The number of completed screens is displayed in the top right (see Scoring)
* - If the player has guessed correctly, the score is updated and play continues (see Scoring)
* - If the player has guessed incorrectly, the status will change to GO (Game Over)
* - The current card will be revealed
* - Pressing `ALARM` or `LIGHT` will transition to the "Score" screen
* - If the game is won, the status indicator will display "WI" and the "Win" screen will be displayed
* - Pressing `ALARM` or `LIGHT` will transition to the "Score" screen
* - The status indicator will change to "SC" when the final score is displayed
* - The number of completed game screens will be displayed on using the first two digits
* - The number of correct guesses will be displayed using the final three digits
* - E.g. "13: 063" represents 13 completed screens, with 63 correct guesses
* - Pressing `ALARM` or `LIGHT` while on the "Score" screen will transition to back to the "Title" screen
*
* Scoring:
* - If the player guesses correctly (HI/LO) a point is gained
* - If the player guesses incorrectly the game ends
* - Unless the revealed card is equal (==) to the last card, in which case play continues, but no point is gained
* - If the player completes 40 screens full of cards, the game ends and a win screen is displayed
*
* Misc:
* The face tries to remain true to the spirit of using "cards"; to cope with the display limitations I've arrived at
* the following mapping of card values to screen display, but am open to better suggestions:
*
* | Cards | |
* |---------|--------------------------|
* | Value |2|3|4|5|6|7|8|9|10|J|Q|K|A|
* | Display |2|3|4|5|6|7|8|9| 0|-|=|≡|H|
*
* The following may more legible choice:
* | Cards | |
* |---------|--------------------------|
* | Value |2|3|4|5|6|7|8|9|10|J|Q|K|A|
* | Display |0|1|2|3|4|5|6|7|8 |9|-|=|≡|
*
* Future Ideas:
* - Add sounds
* - Save/Display high score
* - Add a "Win" animation
* - Consider using lap indicator for larger score limit
*/

typedef struct {
Expand All @@ -52,4 +101,3 @@ void higher_lower_game_face_resign(movement_settings_t *settings, void *context)
})

#endif // HIGHER_LOWER_GAME_FACE_H_

0 comments on commit b147ac0

Please sign in to comment.