Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for delta_row in [self.height - 1, 0, 1].iter().cloned() {
- for delta_col in [self.width - 1, 0, 1].iter().cloned() {
- if delta_row == 0 && delta_col == 0 {
- continue;
- }
- let neighbor_row = (row + delta_row) % self.height;
- let neighbor_col = (column + delta_col) % self.width;
- let idx = self.get_index(neighbor_row, neighbor_col);
- count += self.cells[idx] as u8;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement