Skip to content

Commit

Permalink
Fixed the /stockfish_eval command
Browse files Browse the repository at this point in the history
  • Loading branch information
programarivm committed Jan 17, 2024
1 parent 87b5e3f commit 3f03dab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/Command/StockfishEvalCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ public function __construct()
$this->name = '/stockfish_eval';
$this->description = "Returns Stockfish's evaluation for the given position.";
$this->params = [
// mandatory params
'fen' => '<string>',
'variant' => '<string>',
];
}

Expand Down
17 changes: 13 additions & 4 deletions src/Game/AbstractMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,20 @@ public function res($argv, $cmd)
],
];
case StockfishEvalCommand::class:
$board = FenToBoard::create($argv[1]);
$stockfish = new Stockfish($board);
$nag = $stockfish->evalNag($board->toFen(), 'Final');
if (
$argv[2] === ClassicalBoard::VARIANT ||
$argv[2] === Chess960Board::VARIANT
) {
$board = FenToBoard::create($argv[1]);
$stockfish = new Stockfish($board);
$nag = $stockfish->evalNag($board->toFen(), 'Final');
return [
$cmd->name => NagMovetext::glyph($nag),
];
}

return [
$cmd->name => NagMovetext::glyph($nag),
$cmd->name => null,
];
case TutorFenCommand::class:
if ($argv[2] === Chess960Board::VARIANT) {
Expand Down

0 comments on commit 3f03dab

Please sign in to comment.