Compare commits
50 Commits
main
...
a1d788fd5f
Author | SHA1 | Date | |
---|---|---|---|
a1d788fd5f
|
|||
cbf6c48b22
|
|||
1b401b46b2
|
|||
f5ede33bc8
|
|||
de3ff45f1b
|
|||
8f2edd69f7
|
|||
4250e51f29
|
|||
a2cf8d2592
|
|||
c70ed40885
|
|||
ac5529e924
|
|||
6ee868591a
|
|||
4c75d7cca2
|
|||
0bd0d9d234
|
|||
6f32d2bb7b
|
|||
8b714bd197
|
|||
e44bb2767c
|
|||
0f4330bc2e
|
|||
6f43b33697
|
|||
876de98ca9
|
|||
76e5f8f22d
|
|||
10b0939930
|
|||
d96044afa2
|
|||
d983fa57a2
|
|||
f3df0d22af
|
|||
a81ef17429
|
|||
7f0d1f9d59
|
|||
08b9d6e6d4
|
|||
1cf1bfeef9
|
|||
27e9e5afc5
|
|||
f9b9b5a65f
|
|||
a812df4b70
|
|||
af903412ef
|
|||
5d6879ade8
|
|||
e89ac58bec
|
|||
e84df2364f
|
|||
2094a91cc9
|
|||
816d06ab54
|
|||
dcd7922448
|
|||
7967791228
|
|||
64e0c47142
|
|||
7f6e3c1b9e
|
|||
5831a42a10
|
|||
447a49ce36
|
|||
99c5102361
|
|||
bfd057c541
|
|||
c73d8a6b69
|
|||
5cda26576d
|
|||
6e3fcbb0be
|
|||
eef831cb60
|
|||
014babe444
|
@ -97,28 +97,12 @@ impl TetrisBoard {
|
||||
/// Get the value of the cell at the given position.
|
||||
/// Returns [`None`] if (x, y) exceeds the board's bounds.
|
||||
pub fn get_cell(&self, x: usize, y: usize) -> Option<&TetrisCell> {
|
||||
if y >= TetrisBoard::BOARD_HEIGHT {
|
||||
return None;
|
||||
}
|
||||
|
||||
if x >= TetrisBoard::BOARD_WIDTH {
|
||||
return None;
|
||||
}
|
||||
|
||||
return self.board.get(y * TetrisBoard::BOARD_WIDTH + x);
|
||||
}
|
||||
|
||||
/// Get a mutable reference to the cell at the given position.
|
||||
/// Returns [`None`] if (x, y) exceeds the board's bounds.
|
||||
pub fn get_cell_mut(&mut self, x: usize, y: usize) -> Option<&mut TetrisCell> {
|
||||
if y >= TetrisBoard::BOARD_HEIGHT {
|
||||
return None;
|
||||
}
|
||||
|
||||
if x >= TetrisBoard::BOARD_WIDTH {
|
||||
return None;
|
||||
}
|
||||
|
||||
return self.board.get_mut(y * TetrisBoard::BOARD_WIDTH + x);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user