czakop commited on
Commit
0775bfb
·
1 Parent(s): f1b54fb

update get_top_moves tool

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -159,6 +159,8 @@ def get_square_info(fen: str, square_name: str) -> dict:
159
  def get_top_moves(fen: str, top_n: int = 5) -> dict:
160
  """Get the top N moves for a given chess position using StockFish.
161
 
 
 
162
  DISCLAIMER: This function uses the Stockfish chess engine, ONLY use it if explicitly allowed.
163
 
164
  Args:
@@ -173,7 +175,7 @@ def get_top_moves(fen: str, top_n: int = 5) -> dict:
173
  top_moves = [
174
  {
175
  "move": move["pv"][0].uci(),
176
- "score": move["score"].relative.score(),
177
  "mate": move["score"].is_mate(),
178
  }
179
  for move in info
 
159
  def get_top_moves(fen: str, top_n: int = 5) -> dict:
160
  """Get the top N moves for a given chess position using StockFish.
161
 
162
+ Returns a list of the top moves with their absolute scores (in centipawns) and whether they are leading to a mate.
163
+
164
  DISCLAIMER: This function uses the Stockfish chess engine, ONLY use it if explicitly allowed.
165
 
166
  Args:
 
175
  top_moves = [
176
  {
177
  "move": move["pv"][0].uci(),
178
+ "score": move["score"].white().score(),
179
  "mate": move["score"].is_mate(),
180
  }
181
  for move in info