Skip to content

Commit

Permalink
Updated elo
Browse files Browse the repository at this point in the history
  • Loading branch information
programarivm committed Oct 9, 2024
1 parent 2c2e7dc commit 43dada4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Command/Game/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(Pool $pool)
$this->commands->attach((new HeuristicCommand())->setPool($pool));
$this->commands->attach((new LeaveCommand())->setPool($pool));
$this->commands->attach(new LegalCommand());
$this->commands->attach(new PlayLanCommand());
$this->commands->attach((new PlayLanCommand())->setPool($pool));
$this->commands->attach((new PlayRavCommand())->setPool($pool));
$this->commands->attach(new RandomizerCommand());
$this->commands->attach((new ResignCommand())->setPool($pool));
Expand Down
7 changes: 5 additions & 2 deletions src/Command/Game/PlayLanCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace ChessServer\Command\Game;

use ChessServer\Command\AbstractCommand;
use ChessServer\Command\UpdateEloAsyncTask;
use ChessServer\Command\Game\Mode\PlayMode;
use ChessServer\Socket\AbstractSocket;

Expand Down Expand Up @@ -31,8 +32,10 @@ public function run(AbstractSocket $socket, array $argv, int $id)
$isValid = $gameMode->getGame()->playLan($params['color'], $params['lan']);
if ($isValid) {
if (isset($gameMode->getGame()->state()->end)) {
// TODO ...
// Update elo
$this->pool->add(new UpdateEloAsyncTask([
'result' => $gameMode->getGame()->state()->end['result'],
'decoded' => $gameMode->getJwtDecoded(),
]));
} else {
$gameMode->updateTimer($params['color']);
}
Expand Down

0 comments on commit 43dada4

Please sign in to comment.