From 15d9b809a0d4583ece356033dfcc91da178b1e1c Mon Sep 17 00:00:00 2001 From: programarivm Date: Thu, 30 May 2024 17:18:07 +0200 Subject: [PATCH] Deleted the Capablanca variants --- src/Command/RestartCommand.php | 7 ---- src/Command/StartCommand.php | 63 ---------------------------------- src/Game/AbstractMode.php | 19 ++-------- src/Game/Game.php | 10 ------ 4 files changed, 2 insertions(+), 97 deletions(-) diff --git a/src/Command/RestartCommand.php b/src/Command/RestartCommand.php index f9729976..75801276 100644 --- a/src/Command/RestartCommand.php +++ b/src/Command/RestartCommand.php @@ -2,7 +2,6 @@ namespace ChessServer\Command; -use Chess\Variant\CapablancaFischer\FEN\StrToBoard as CapablancaFischerFenStrToBoard; use Chess\Variant\Chess960\FEN\StrToBoard as Chess960FenStrToBoard; use Chess\Variant\Classical\PGN\AN\Color; use ChessServer\Game\Game; @@ -36,12 +35,6 @@ public function run(ChesslaBlabSocket $socket, array $argv, int $id) $startPos = str_split($decoded->startPos); $board = (new Chess960FenStrToBoard($decoded->fen, $startPos))->create(); $game = (new Game($decoded->variant, Game::MODE_PLAY))->setBoard($board); - } elseif ($decoded->variant === Game::VARIANT_CAPABLANCA) { - $game = new Game($decoded->variant, Game::MODE_PLAY); - } elseif ($decoded->variant === Game::VARIANT_CAPABLANCA_FISCHER) { - $startPos = str_split($decoded->startPos); - $board = (new CapablancaFischerFenStrToBoard($decoded->fen, $startPos))->create(); - $game = (new Game($decoded->variant, Game::MODE_PLAY))->setBoard($board); } else { $game = new Game($decoded->variant, Game::MODE_PLAY); } diff --git a/src/Command/StartCommand.php b/src/Command/StartCommand.php index 36bfa9d7..3b387cc5 100644 --- a/src/Command/StartCommand.php +++ b/src/Command/StartCommand.php @@ -4,11 +4,6 @@ use Chess\FenToBoardFactory; use Chess\Play\SanPlay; -use Chess\Variant\Capablanca\Board as CapablancaBoard; -use Chess\Variant\Capablanca\FEN\StrToBoard as CapablancaFenStrToBoard; -use Chess\Variant\CapablancaFischer\Board as CapablancaFischerBoard; -use Chess\Variant\CapablancaFischer\StartPosition as CapablancaFischerStartPosition; -use Chess\Variant\CapablancaFischer\FEN\StrToBoard as CapablancaFischerFenStrToBoard; use Chess\Variant\Chess960\Board as Chess960Board; use Chess\Variant\Chess960\StartPosition as Chess960StartPosition; use Chess\Variant\Chess960\FEN\StrToBoard as Chess960FenStrToBoard; @@ -33,8 +28,6 @@ public function __construct() // mandatory param 'variant' => [ Game::VARIANT_960, - Game::VARIANT_CAPABLANCA, - Game::VARIANT_CAPABLANCA_FISCHER, Game::VARIANT_CLASSICAL, ], // mandatory param @@ -98,21 +91,6 @@ public function run(ChesslaBlabSocket $socket, array $argv, int $id) $startPos = (new Chess960StartPosition())->create(); $board = new Chess960Board($startPos); } - } elseif ($argv[1] === Game::VARIANT_CAPABLANCA) { - if (isset($settings->fen)) { - $board = (new CapablancaFenStrToBoard($settings->fen))->create(); - } else { - $board = new CapablancaBoard(); - } - } elseif ($argv[1] === Game::VARIANT_CAPABLANCA_FISCHER) { - if (isset($settings->fen) && isset($settings->startPos)) { - $startPos = str_split($settings->startPos); - $board = (new CapablancaFischerFenStrToBoard($settings->fen, $startPos)) - ->create(); - } else { - $startPos = (new CapablancaFischerStartPosition())->create(); - $board = new CapablancaFischerBoard($startPos); - } } else { if (isset($settings->fen)) { $board = (new ClassicalFenStrToBoard($settings->fen))->create(); @@ -136,10 +114,6 @@ public function run(ChesslaBlabSocket $socket, array $argv, int $id) ? ['startPos' => implode('', $startPos)] : [] ), - ...($argv[1] === Game::VARIANT_CAPABLANCA_FISCHER - ? ['startPos' => implode('', $startPos)] - : [] - ), ], ]); } catch (\Throwable $e) { @@ -161,19 +135,6 @@ public function run(ChesslaBlabSocket $socket, array $argv, int $id) $board = FenToBoardFactory::create($settings->fen, $board); } $sanPlay = new SanPlay($settings->movetext, $board); - } elseif ($argv[1] === Game::VARIANT_CAPABLANCA) { - $board = new CapablancaBoard(); - if (isset($settings->fen)) { - $board = FenToBoardFactory::create($settings->fen, $board); - } - $sanPlay = new SanPlay($settings->movetext, $board); - } elseif ($argv[1] === Game::VARIANT_CAPABLANCA_FISCHER) { - $startPos = str_split($settings->startPos); - $board = new CapablancaFischerBoard($startPos); - if (isset($settings->fen)) { - $board = FenToBoardFactory::create($settings->fen, $board); - } - $sanPlay = new SanPlay($settings->movetext, $board); } else { $board = new ClassicalBoard(); if (isset($settings->fen)) { @@ -198,10 +159,6 @@ public function run(ChesslaBlabSocket $socket, array $argv, int $id) ? ['startPos' => $settings->startPos] : [] ), - ...($argv[1] === Game::VARIANT_CAPABLANCA_FISCHER - ? ['startPos' => $settings->startPos] - : [] - ), ], ]); } catch (\Throwable $e) { @@ -221,13 +178,6 @@ public function run(ChesslaBlabSocket $socket, array $argv, int $id) $startPos = str_split($settings->startPos); $board = (new Chess960FenStrToBoard($settings->fen, $startPos)) ->create(); - } elseif ($argv[1] === Game::VARIANT_CAPABLANCA) { - $board = (new CapablancaFenStrToBoard($settings->fen)) - ->create(); - } elseif ($argv[1] === Game::VARIANT_CAPABLANCA_FISCHER) { - $startPos = str_split($settings->startPos); - $board = (new CapablancaFischerBoard($settings->fen, $startPos)) - ->create(); } else { $board = (new ClassicalFenStrToBoard($settings->fen)) ->create(); @@ -245,11 +195,6 @@ public function run(ChesslaBlabSocket $socket, array $argv, int $id) if ($argv[1] === Game::VARIANT_960) { $startPos = (new Chess960StartPosition())->create(); $board = new Chess960Board($startPos); - } elseif ($argv[1] === Game::VARIANT_CAPABLANCA) { - $board = new CapablancaBoard(); - } elseif ($argv[1] === Game::VARIANT_CAPABLANCA_FISCHER) { - $startPos = (new CapablancaFischerStartPosition())->create(); - $board = new CapablancaFischerBoard($startPos); } else { $board = new ClassicalBoard(); } @@ -269,10 +214,6 @@ public function run(ChesslaBlabSocket $socket, array $argv, int $id) ? ['startPos' => implode('', $game->getBoard()->getStartPos())] : [] ), - ...($argv[1] === Game::VARIANT_CAPABLANCA_FISCHER - ? ['startPos' => implode('', $game->getBoard()->getStartPos())] - : [] - ), ...(isset($settings->fen) ? ['fen' => $settings->fen] : [] @@ -300,10 +241,6 @@ public function run(ChesslaBlabSocket $socket, array $argv, int $id) ? ['startPos' => implode('', $game->getBoard()->getStartPos())] : [] ), - ...($argv[1] === Game::VARIANT_CAPABLANCA_FISCHER - ? ['startPos' => implode('', $game->getBoard()->getStartPos())] - : [] - ), ], ]); } elseif (StockfishMode::NAME === $argv[2]) { diff --git a/src/Game/AbstractMode.php b/src/Game/AbstractMode.php index 94ec9220..10073fe9 100644 --- a/src/Game/AbstractMode.php +++ b/src/Game/AbstractMode.php @@ -7,7 +7,6 @@ use Chess\Heuristics\FenHeuristics; use Chess\Movetext\NagMovetext; use Chess\Tutor\FenEvaluation; -use Chess\Variant\Capablanca\Board as CapablancaBoard; use Chess\Variant\Chess960\Board as Chess960Board; use Chess\Variant\Classical\Board as ClassicalBoard; use ChessServer\Game\Game; @@ -65,14 +64,7 @@ public function res($argv, $cmd) { switch (get_class($cmd)) { case HeuristicsCommand::class: - if ( - $argv[2] === Game::VARIANT_CAPABLANCA || - $argv[2] === Game::VARIANT_CAPABLANCA_FISCHER - ) { - $board = FenToBoardFactory::create($argv[1], new CapablancaBoard()); - } else { - $board = FenToBoardFactory::create($argv[1], new ClassicalBoard()); - } + $board = FenToBoardFactory::create($argv[1], new ClassicalBoard()); return [ $cmd->name => [ 'names' => (new StandardFunction())->names(), @@ -112,14 +104,7 @@ public function res($argv, $cmd) ]; case TutorFenCommand::class: - if ( - $argv[2] === Game::VARIANT_CAPABLANCA || - $argv[2] === Game::VARIANT_CAPABLANCA_FISCHER - ) { - $board = FenToBoardFactory::create($argv[1], new CapablancaBoard()); - } else { - $board = FenToBoardFactory::create($argv[1], new ClassicalBoard()); - } + $board = FenToBoardFactory::create($argv[1], new ClassicalBoard()); $paragraph = (new FenEvaluation($board))->getParagraph(); return [ $cmd->name => implode(' ', $paragraph), diff --git a/src/Game/Game.php b/src/Game/Game.php index 5f5f69e6..6b73b5a5 100644 --- a/src/Game/Game.php +++ b/src/Game/Game.php @@ -5,9 +5,6 @@ use Chess\Computer\GrandmasterMove; use Chess\UciEngine\UciEngine; use Chess\UciEngine\Details\Limit; -use Chess\Variant\Capablanca\Board as CapablancaBoard; -use Chess\Variant\CapablancaFischer\Board as CapablancaFischerBoard; -use Chess\Variant\CapablancaFischer\StartPosition as CapablancaFischerStartPosition; use Chess\Variant\Chess960\Board as Chess960Board; use Chess\Variant\Chess960\StartPosition as Chess960StartPosition; use Chess\Variant\Classical\Board as ClassicalBoard; @@ -21,8 +18,6 @@ class Game { const VARIANT_960 = Chess960Board::VARIANT; - const VARIANT_CAPABLANCA = CapablancaBoard::VARIANT; - const VARIANT_CAPABLANCA_FISCHER = CapablancaFischerBoard::VARIANT; const VARIANT_CLASSICAL = ClassicalBoard::VARIANT; const MODE_FEN = 'fen'; @@ -77,11 +72,6 @@ public function __construct( if ($this->variant === self::VARIANT_960) { $startPos = (new Chess960StartPosition())->create(); $this->board = new Chess960Board($startPos); - } elseif ($this->variant === self::VARIANT_CAPABLANCA) { - $this->board = new CapablancaBoard(); - } elseif ($this->variant === self::VARIANT_CAPABLANCA_FISCHER) { - $startPos = (new CapablancaFischerStartPosition())->create(); - $this->board = new CapablancaFischerBoard($startPos); } elseif ($this->variant === self::VARIANT_CLASSICAL) { $this->board = new ClassicalBoard(); }