bstraehle commited on
Commit
3733564
·
verified ·
1 Parent(s): 0e74140

Update multi_agent.py

Browse files
Files changed (1) hide show
  1. multi_agent.py +6 -5
multi_agent.py CHANGED
@@ -6,6 +6,7 @@ board = None
6
  board_svgs = None
7
  made_move = None
8
  game_over = False
 
9
 
10
  def get_legal_moves() -> Annotated[str, "A list of legal moves in UCI format"]:
11
  print("###### get_legal_moves")
@@ -14,7 +15,7 @@ def get_legal_moves() -> Annotated[str, "A list of legal moves in UCI format"]:
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
@@ -103,8 +104,8 @@ def run_multi_agent(llm_white, llm_black, num_moves):
103
  system_message="You are a chess Grandmaster and you play as white. "
104
  "First call get_legal_moves(), to get a list of legal moves. "
105
  "If there is no legal move, call set_game_over() "
106
- "Else call make_move(move) to make a legal move. "
107
- "Analyze the move in 3 bullet points. Respond in format **Analysis:** move in UCI format (emoji of piece), unordered list.",
108
  llm_config=llm_config_white,
109
  is_termination_msg=check_game_over
110
  )
@@ -114,8 +115,8 @@ def run_multi_agent(llm_white, llm_black, num_moves):
114
  system_message="You are a chess Grandmaster and you play as black. "
115
  "First call get_legal_moves(), to get a list of legal moves. "
116
  "If there is no legal move, call set_game_over() "
117
- "Else call make_move(move) to make a legal move. "
118
- "Analyze the move in 3 bullet points. Respond in format **Analysis:** move in UCI format (emoji of piece), unordered list.",
119
  llm_config=llm_config_black,
120
  is_termination_msg=check_game_over
121
  )
 
6
  board_svgs = None
7
  made_move = None
8
  game_over = False
9
+ move_num = 0
10
 
11
  def get_legal_moves() -> Annotated[str, "A list of legal moves in UCI format"]:
12
  print("###### get_legal_moves")
 
15
  )
16
 
17
  def make_move(move: Annotated[str, "A move in UCI format."]) -> Annotated[str, "Result of the move."]:
18
+ print("###### make_move: " + str(move_num += 1))
19
  move = chess.Move.from_uci(move)
20
  board.push_uci(str(move))
21
  global made_move
 
104
  system_message="You are a chess Grandmaster and you play as white. "
105
  "First call get_legal_moves(), to get a list of legal moves. "
106
  "If there is no legal move, call set_game_over() "
107
+ "Else call make_move(move) to make a legal move. ",
108
+ #"Analyze the move in 3 bullet points. Respond in format **Analysis:** move in UCI format (emoji of piece), unordered list.",
109
  llm_config=llm_config_white,
110
  is_termination_msg=check_game_over
111
  )
 
115
  system_message="You are a chess Grandmaster and you play as black. "
116
  "First call get_legal_moves(), to get a list of legal moves. "
117
  "If there is no legal move, call set_game_over() "
118
+ "Else call make_move(move) to make a legal move. ",
119
+ #"Analyze the move in 3 bullet points. Respond in format **Analysis:** move in UCI format (emoji of piece), unordered list.",
120
  llm_config=llm_config_black,
121
  is_termination_msg=check_game_over
122
  )