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

Method draw_matrix

fl16-inputmodules/src/games/snake.rs:97–109  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

95 }
96 }
97 pub fn draw_matrix(&self) -> Grid {
98 let (x, y) = self.head;
99 let mut grid = Grid::default();
100
101 grid.0[x as usize][y as usize] = 0xFF;
102 grid.0[self.food.0 as usize][self.food.1 as usize] = 0xFF;
103 for bodypart in &self.body {
104 let (x, y) = bodypart;
105 grid.0[*x as usize][*y as usize] = 0xFF;
106 }
107
108 grid
109 }
110}
111
112fn place_food(random: u8) -> Position {

Callers 1

game_stepFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected