55 neighbor.
x += penguin.
x, neighbor.
y += penguin.
y;
72 target.
x += d.
x, target.
y += d.
y;
76 moves.
steps[dir] = steps;
Functions for working with the game board (and the specifics of its encoding)
#define is_fish_tile(tile)
The core of the unified game logic library, contains the Game struct.
@ MOVEMENT_OVER_EMPTY_TILE
@ MOVEMENT_PENGUIN_BLOCKED
@ MOVEMENT_NOT_YOUR_PENGUIN
@ MOVEMENT_CURRENT_LOCATION
@ MOVEMENT_ONTO_EMPTY_TILE
A pair of 2D coordinates, used for addressing the Game::board_grid.
The central struct of the application, holds the game data and settings.
ALWAYS_INLINE bool is_tile_in_bounds(const Game *game, Coords coords)
Checks if the given coords are within the bounds of the board.
int movement_switch_player(Game *game)
Performs the player switching logic for the movement phase.
void move_penguin(Game *game, Coords start, Coords target)
Creates a GameLogMovement entry. The requested move must be valid.
ALWAYS_INLINE short get_tile(const Game *game, Coords coords)
Returns the value of the tile at coords. Fails if coords are outside the bounds.
bool any_valid_player_move_exists(const Game *game, int player_idx)
int count_obstructed_directions(const Game *game, Coords penguin)
void movement_begin(Game *game)
Enters the GAME_PHASE_MOVEMENT phase, can only be called in GAME_PHASE_SETUP_DONE.
PossibleSteps calculate_penguin_possible_moves(const Game *game, Coords start)
MovementError validate_movement(const Game *game, Coords start, Coords target, Coords *fail)
MovementError validate_movement_start(const Game *game, Coords start)
void movement_end(Game *game)
Exits the GAME_PHASE_MOVEMENT phase and switches to GAME_PHASE_SETUP_DONE.
void undo_move_penguin(Game *game)
Removes a GameLogMovement entry from the log and undoes it.
Exists purely to wrap an array of the numbers of steps in every possible Direction.
const Coords DIRECTION_TO_COORDS[DIRECTION_MAX]
A table that maps Direction variants to relative Coords.