MCPcopy Index your code
hub / github.com/FrameworkComputer/inputmodule-rs / game_step

Function game_step

fl16-inputmodules/src/games/snake.rs:132–148  ·  view source on GitHub ↗
(state: &mut LedmatrixState, random: u8)

Source from the content-addressed store, hash-verified

130}
131
132pub fn game_step(state: &mut LedmatrixState, random: u8) -> (HeadDirection, bool, usize, Position) {
133 if let Some(GameState::Snake(ref mut snake_state)) = state.game {
134 snake_state.tick(random);
135
136 if !snake_state.game_over {
137 state.grid = snake_state.draw_matrix();
138 }
139 (
140 snake_state.direction,
141 snake_state.game_over,
142 snake_state.body.len(),
143 snake_state.head,
144 )
145 } else {
146 (HeadDirection::Down, true, 0, (0, 0))
147 }
148}

Callers

nothing calls this directly

Calls 2

tickMethod · 0.45
draw_matrixMethod · 0.45

Tested by

no test coverage detected