Skip to content

Commit fa4f41e

Browse files
committed
Fix moves bug
1 parent 4d6479a commit fa4f41e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

tictactoe.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def handleEvents(self):
170170
def handleClick(self, mousePos):
171171
x, y = mousePos
172172
if self.GRID_SIZE + self.SIDE_PADDING >= x >= self.SIDE_PADDING and self.HEADER_HEIGHT + self.GRID_SIZE >= y >= self.HEADER_HEIGHT:
173-
move = ((y - self.HEADER_HEIGHT) // self.LINE_WIDTH, (x - self.SIDE_PADDING) // self.LINE_WIDTH)
173+
move = ((y - self.HEADER_HEIGHT) // self.CELL_WIDTH, (x - self.SIDE_PADDING) // self.CELL_WIDTH)
174174
try:
175175
self.grid.play(1, move)
176176
except TicTacToeExceptions.WrongTurnError:
@@ -194,4 +194,3 @@ def loadAssets(self, assetsPath):
194194
Game(assetsPath=('TicTacToe', 'Resources'), saveToCloud=True)
195195
except GameException as e:
196196
messagebox.showerror('ERROR', f'{e.__class__.__name__}: {e}')
197-
raise e

0 commit comments

Comments
 (0)