Update multi_agent.py
Browse files- multi_agent.py +8 -13
multi_agent.py
CHANGED
@@ -12,8 +12,6 @@ def get_legal_moves() -> Annotated[str, "A list of legal moves in UCI format"]:
|
|
12 |
[str(move) for move in board.legal_moves]
|
13 |
)
|
14 |
|
15 |
-
return moves
|
16 |
-
|
17 |
def make_move(move: Annotated[str, "A move in UCI format."]) -> Annotated[str, "Result of the move."]:
|
18 |
move = chess.Move.from_uci(move)
|
19 |
board.push_uci(str(move))
|
@@ -40,11 +38,6 @@ def make_move(move: Annotated[str, "A move in UCI format."]) -> Annotated[str, "
|
|
40 |
f"{chess.SQUARE_NAMES[move.to_square]}."
|
41 |
|
42 |
def check_made_move(msg):
|
43 |
-
print("###")
|
44 |
-
print(msg)
|
45 |
-
print(str(len(board_svgs)))
|
46 |
-
print("###")
|
47 |
-
|
48 |
global made_move
|
49 |
|
50 |
if made_move:
|
@@ -81,7 +74,8 @@ def run_multi_agent(llm_white, llm_black, num_moves):
|
|
81 |
name="Player White",
|
82 |
system_message="You are a chess Grandmaster and you play as white. "
|
83 |
"First call get_legal_moves(), to get a list of legal moves. "
|
84 |
-
"
|
|
|
85 |
llm_config=llm_config_white,
|
86 |
)
|
87 |
|
@@ -89,7 +83,8 @@ def run_multi_agent(llm_white, llm_black, num_moves):
|
|
89 |
name="Player Black",
|
90 |
system_message="You are a chess Grandmaster and you play as black. "
|
91 |
"First call get_legal_moves(), to get a list of legal moves. "
|
92 |
-
"
|
|
|
93 |
llm_config=llm_config_black,
|
94 |
)
|
95 |
|
@@ -169,8 +164,8 @@ def run_multi_agent(llm_white, llm_black, num_moves):
|
|
169 |
if num_moves % 2 == 0 and num_move == num_moves + 1:
|
170 |
break
|
171 |
|
172 |
-
print("===")
|
173 |
-
print(result)
|
174 |
-
print("===")
|
175 |
|
176 |
-
return result
|
|
|
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))
|
|
|
38 |
f"{chess.SQUARE_NAMES[move.to_square]}."
|
39 |
|
40 |
def check_made_move(msg):
|
|
|
|
|
|
|
|
|
|
|
41 |
global made_move
|
42 |
|
43 |
if made_move:
|
|
|
74 |
name="Player White",
|
75 |
system_message="You are a chess Grandmaster and you play as white. "
|
76 |
"First call get_legal_moves(), to get a list of legal moves. "
|
77 |
+
"Then call make_move(move) to make a move. "
|
78 |
+
"Analyze the move in 3 bullet points. Respond in format **Analysis:** move in UCI format, unordered list.",
|
79 |
llm_config=llm_config_white,
|
80 |
)
|
81 |
|
|
|
83 |
name="Player Black",
|
84 |
system_message="You are a chess Grandmaster and you play as black. "
|
85 |
"First call get_legal_moves(), to get a list of legal moves. "
|
86 |
+
"Then call make_move(move) to make a move. "
|
87 |
+
"Analyze the move in 3 bullet points. Respond in format **Analysis:** move in UCI format, unordered list.",
|
88 |
llm_config=llm_config_black,
|
89 |
)
|
90 |
|
|
|
164 |
if num_moves % 2 == 0 and num_move == num_moves + 1:
|
165 |
break
|
166 |
|
167 |
+
#print("===")
|
168 |
+
#print(result)
|
169 |
+
#print("===")
|
170 |
|
171 |
+
return result
|