Spaces:
Runtime error
Runtime error
valentin urena
commited on
Update chess_board.py
Browse files- chess_board.py +4 -3
chess_board.py
CHANGED
|
@@ -75,7 +75,7 @@ class Game:
|
|
| 75 |
return True
|
| 76 |
except:
|
| 77 |
print(f"Invalid move '{move}'. Use algebraic notation (e.g., 'e4', 'Nf3', 'Bxc4') or ask Gemma for help.")
|
| 78 |
-
return
|
| 79 |
|
| 80 |
def reset_board(self):
|
| 81 |
self.board = chess.Board()
|
|
@@ -85,12 +85,13 @@ class Game:
|
|
| 85 |
return self.display_board()
|
| 86 |
|
| 87 |
def generate_moves(self, move):
|
| 88 |
-
|
|
|
|
| 89 |
yield self.display_board()
|
| 90 |
yield self.gemma_moves()
|
| 91 |
else:
|
| 92 |
print("Try again")
|
| 93 |
-
|
| 94 |
|
| 95 |
def main():
|
| 96 |
end_game = False # Change this to False
|
|
|
|
| 75 |
return True
|
| 76 |
except:
|
| 77 |
print(f"Invalid move '{move}'. Use algebraic notation (e.g., 'e4', 'Nf3', 'Bxc4') or ask Gemma for help.")
|
| 78 |
+
return False
|
| 79 |
|
| 80 |
def reset_board(self):
|
| 81 |
self.board = chess.Board()
|
|
|
|
| 85 |
return self.display_board()
|
| 86 |
|
| 87 |
def generate_moves(self, move):
|
| 88 |
+
valid_move = self.player_moves(move)
|
| 89 |
+
if valid_move:
|
| 90 |
yield self.display_board()
|
| 91 |
yield self.gemma_moves()
|
| 92 |
else:
|
| 93 |
print("Try again")
|
| 94 |
+
yield self.display_board()
|
| 95 |
|
| 96 |
def main():
|
| 97 |
end_game = False # Change this to False
|