bstraehle commited on
Commit
1db8a06
·
verified ·
1 Parent(s): aa6289e

Update multi_agent.py

Browse files
Files changed (1) hide show
  1. multi_agent.py +7 -8
multi_agent.py CHANGED
@@ -10,23 +10,22 @@ class MultiAgent:
10
 
11
  def get_legal_moves() -> Annotated[str, "A list of legal moves in UCI format"]:
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
  move = chess.Move.from_uci(move)
18
- board.push_uci(str(move))
19
- global made_move
20
- made_move = True
21
 
22
- board_svgs.append(chess.svg.board(
23
- board,
24
  arrows=[(move.from_square, move.to_square)],
25
  fill={move.from_square: "gray"},
26
  size=250
27
  ))
28
 
29
- piece = board.piece_at(move.to_square)
30
  piece_symbol = piece.unicode_symbol()
31
  piece_name = (
32
  chess.piece_name(piece.piece_type).capitalize()
@@ -156,7 +155,7 @@ class MultiAgent:
156
  player = "Player White"
157
 
158
  if num_move > 0:
159
- result += f"**{player}, Move {num_move}**<br>{chat.get('content')}<br>{board_svgs[num_move - 1]}<br><br>"
160
 
161
  num_move += 1
162
 
 
10
 
11
  def get_legal_moves() -> Annotated[str, "A list of legal moves in UCI format"]:
12
  return "Possible moves are: " + ",".join(
13
+ [str(move) for move in self.board.legal_moves]
14
  )
15
 
16
  def make_move(move: Annotated[str, "A move in UCI format."]) -> Annotated[str, "Result of the move."]:
17
  move = chess.Move.from_uci(move)
18
+ self.board.push_uci(str(move))
19
+ self.made_move = True
 
20
 
21
+ self.board_svgs.append(chess.svg.board(
22
+ self.board,
23
  arrows=[(move.from_square, move.to_square)],
24
  fill={move.from_square: "gray"},
25
  size=250
26
  ))
27
 
28
+ piece = self.board.piece_at(move.to_square)
29
  piece_symbol = piece.unicode_symbol()
30
  piece_name = (
31
  chess.piece_name(piece.piece_type).capitalize()
 
155
  player = "Player White"
156
 
157
  if num_move > 0:
158
+ result += f"**{player}, Move {num_move}**<br>{chat.get('content')}<br>{self.board_svgs[num_move - 1]}<br><br>"
159
 
160
  num_move += 1
161