|
SNAKE_STM32F3
|
Snake game logic module with low level state machine. More...


Go to the source code of this file.
Data Structures | |
| struct | snake_state |
| Structure holding all snake info. More... | |
Macros | |
| #define | GAME_DIM 8 |
| Width of the game in snake length units (should be consulted with dispay width). | |
| #define | MAX_SNAKE_SIZE (GAME_DIM*GAME_DIM) |
| Maximum size that can be occupied by snake body parts. | |
Enumerations | |
| enum | state_t { INIT , GAME_OVER , RUNNING } |
| snake game state type More... | |
Functions | |
| void | snake_update (void) |
| snake logic state machine function. | |
| void | snake_direction_request (direction_t requested_direction) |
| Requests change of current snake direction in state machine. | |
| void | snake_init_request (int fruit_seed) |
| Requests initialization of the snake game in state machine. | |
| void | snake_move_request (void) |
| Requests 1-tile move of snake in state machine. | |
| bool | snake_is_over (void) |
| Checks if snake game state is GAME_OVER. | |
| const snake_state * | snake_get_state (void) |
| Passes current snake game state. | |
Snake game logic module with low level state machine.
SPDX-License-Identifier: MIT
| #define GAME_DIM 8 |
Width of the game in snake length units (should be consulted with dispay width).
| enum state_t |
| void snake_direction_request | ( | direction_t | requested_direction | ) |
Requests change of current snake direction in state machine.
| requested_direction | Direction requested by input system. |
| const snake_state * snake_get_state | ( | void | ) |
Passes current snake game state.
| void snake_init_request | ( | int | fruit_seed | ) |
Requests initialization of the snake game in state machine.
| fruit_seed | Seed used for random fruit position generator. |
| bool snake_is_over | ( | void | ) |
Checks if snake game state is GAME_OVER.
| void snake_move_request | ( | void | ) |
Requests 1-tile move of snake in state machine.
| void snake_update | ( | void | ) |
snake logic state machine function.
Handles three snake game states (INIT, GAME_OVER, RUNNING).
