(random: u8)
| 110 | } |
| 111 | |
| 112 | fn place_food(random: u8) -> Position { |
| 113 | // TODO: while food == head: |
| 114 | let x = ((random & 0xF0) >> 4) % WIDTH as u8; |
| 115 | let y = (random & 0x0F) % HEIGHT as u8; |
| 116 | (x as i8, y as i8) |
| 117 | } |
| 118 | |
| 119 | pub fn start_game(state: &mut LedmatrixState, random: u8) { |
| 120 | state.game = Some(GameState::Snake(SnakeState::new(random))); |