добавил игру аркадия, но не полностью

добавил лягушек в книгу
This commit is contained in:
2023-01-28 11:06:37 +07:00
parent 2950823179
commit c7a8cb521f
7 changed files with 177 additions and 129 deletions
+4 -2
View File
@@ -28,12 +28,14 @@ class Board:
self.board[x][cell_coords[1]] = (self.board[x][cell_coords[1]] + 1) % 2
for y in range(self.width):
self.board[cell_coords[0]][y] = (self.board[cell_coords[0]][y] + 1) % 2
self.board[cell_coords[0]][cell_coords[1]] = (self.board[cell_coords[0]][cell_coords[1]] + 1) % 2
new_cell = (self.board[cell_coords[0]][cell_coords[1]] + 1) % 2
self.board[cell_coords[0]][cell_coords[1]] = new_cell
def get_cell(self, mouse_pos):
if self.left <= mouse_pos[1] < self.left + self.height * self.cell_size and \
self.top <= mouse_pos[0] < self.top + self.width * self.cell_size:
return int((mouse_pos[1] - self.left) / self.cell_size), int((mouse_pos[0] - self.top) / self.cell_size)
cell = int((mouse_pos[1] - self.left) / self.cell_size), int((mouse_pos[0] - self.top) / self.cell_size)
return cell
else:
return None