Rename variables in method to avoid confusion
This commit is contained in:
parent
4e7d631e42
commit
0177f0ccbe
12
board.py
12
board.py
|
@ -137,12 +137,12 @@ class Board:
|
||||||
self.game_started = True
|
self.game_started = True
|
||||||
|
|
||||||
def squares_adjacent_to(self, s):
|
def squares_adjacent_to(self, s):
|
||||||
x, y = self.get_index(s)
|
i, j = self.get_index(s)
|
||||||
adj_indices = [(x-1,y-1), (x,y-1), (x+1,y-1),
|
adj_indices = [(i-1,j-1), (i,j-1), (i+1,j-1),
|
||||||
(x-1,y), (x+1,y),
|
(i-1,j), (i+1,j),
|
||||||
(x+1,y+1), (x,y+1), (x-1,y+1)]
|
(i-1,j+1), (i,j+1), (i+1,j+1)]
|
||||||
adj_squares = [self.squares[i[0]][i[1]] for i in adj_indices
|
adj_squares = [self.squares[i][j] for i, j in adj_indices
|
||||||
if 0 <= i[0] < self.size[0] and 0 <= i[1] < self.size[1]]
|
if 0 <= i < self.size[0] and 0 <= j < self.size[1]]
|
||||||
return adj_squares
|
return adj_squares
|
||||||
|
|
||||||
def open(self, s):
|
def open(self, s):
|
||||||
|
|
Loading…
Reference in New Issue