(state: &mut LedmatrixState, random: u8)
| 130 | } |
| 131 | |
| 132 | pub 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 | } |
nothing calls this directly
no test coverage detected