MCPcopy Create free account
hub / github.com/FrameworkComputer/inputmodule-rs / place_food

Function place_food

fl16-inputmodules/src/games/snake.rs:112–117  ·  view source on GitHub ↗
(random: u8)

Source from the content-addressed store, hash-verified

110}
111
112fn 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
119pub fn start_game(state: &mut LedmatrixState, random: u8) {
120 state.game = Some(GameState::Snake(SnakeState::new(random)));

Callers 2

newMethod · 0.85
tickMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected