Update multi_agent.py
Browse files- multi_agent.py +7 -0
multi_agent.py
CHANGED
@@ -8,11 +8,13 @@ made_move = None
|
|
8 |
gaem_over = False
|
9 |
|
10 |
def get_legal_moves() -> Annotated[str, "A list of legal moves in UCI format"]:
|
|
|
11 |
return "Possible moves are: " + ",".join(
|
12 |
[str(move) for move in board.legal_moves]
|
13 |
)
|
14 |
|
15 |
def make_move(move: Annotated[str, "A move in UCI format."]) -> Annotated[str, "Result of the move."]:
|
|
|
16 |
move = chess.Move.from_uci(move)
|
17 |
board.push_uci(str(move))
|
18 |
global made_move
|
@@ -38,9 +40,13 @@ def make_move(move: Annotated[str, "A move in UCI format."]) -> Annotated[str, "
|
|
38 |
f"{chess.SQUARE_NAMES[move.to_square]}."
|
39 |
|
40 |
def game_over():
|
|
|
|
|
|
|
41 |
game_over = True
|
42 |
|
43 |
def check_made_move(msg):
|
|
|
44 |
global made_move
|
45 |
|
46 |
if made_move:
|
@@ -50,6 +56,7 @@ def check_made_move(msg):
|
|
50 |
return False
|
51 |
|
52 |
def check_game_over(msg):
|
|
|
53 |
global game_over
|
54 |
|
55 |
if game_over:
|
|
|
8 |
gaem_over = False
|
9 |
|
10 |
def get_legal_moves() -> Annotated[str, "A list of legal moves in UCI format"]:
|
11 |
+
print("###### get_legal_moves")
|
12 |
return "Possible moves are: " + ",".join(
|
13 |
[str(move) for move in board.legal_moves]
|
14 |
)
|
15 |
|
16 |
def make_move(move: Annotated[str, "A move in UCI format."]) -> Annotated[str, "Result of the move."]:
|
17 |
+
print("###### make_move")
|
18 |
move = chess.Move.from_uci(move)
|
19 |
board.push_uci(str(move))
|
20 |
global made_move
|
|
|
40 |
f"{chess.SQUARE_NAMES[move.to_square]}."
|
41 |
|
42 |
def game_over():
|
43 |
+
print("###### game_over")
|
44 |
+
global game_over
|
45 |
+
|
46 |
game_over = True
|
47 |
|
48 |
def check_made_move(msg):
|
49 |
+
print("###### check_made_move")
|
50 |
global made_move
|
51 |
|
52 |
if made_move:
|
|
|
56 |
return False
|
57 |
|
58 |
def check_game_over(msg):
|
59 |
+
print("###### check_game_over")
|
60 |
global game_over
|
61 |
|
62 |
if game_over:
|