-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented TutorFenCommand as an async command
- Loading branch information
1 parent
708c527
commit f95c8d9
Showing
3 changed files
with
42 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace ChessServer\Command\Game\Async; | ||
|
||
use Chess\FenToBoardFactory; | ||
use Chess\Function\CompleteFunction; | ||
use Chess\Tutor\FenEvaluation; | ||
use Chess\Variant\Classical\Board; | ||
use Spatie\Async\Task; | ||
|
||
class TutorFenTask extends Task | ||
{ | ||
private array $params; | ||
|
||
public function __construct(array $params) | ||
{ | ||
$this->params = $params; | ||
} | ||
|
||
public function configure() | ||
{ | ||
} | ||
|
||
public function run() | ||
{ | ||
$board = FenToBoardFactory::create($this->params['fen'], new Board()); | ||
$paragraph = (new FenEvaluation(new CompleteFunction(), $board))->paragraph; | ||
|
||
return $paragraph; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters