Skip to content

Commit

Permalink
Documented BadBishopEval (chesslablab#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
programarivm authored Oct 18, 2024
1 parent 5bfb091 commit cc0adcc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Eval/BadBishopEval.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,27 @@
use Chess\Variant\Classical\PGN\AN\Color;
use Chess\Variant\Classical\PGN\AN\Piece;

/**
* Bad Bishop Evaluation
*
* A bad bishop is a bishop that is on the same color as most of own pawns.
*/
class BadBishopEval extends AbstractEval implements
ExplainEvalInterface,
InverseEvalInterface
{
use ExplainEvalTrait;

/**
* The name of the heuristic.
*
* @var string
*/
const NAME = 'Bad bishop';

/**
* @param \Chess\Variant\AbstractBoard $board
*/
public function __construct(AbstractBoard $board)
{
$this->board = $board;
Expand Down Expand Up @@ -48,6 +61,12 @@ public function __construct(AbstractBoard $board)
$this->explain($this->result);
}

/**
* Counts the number of blocking pawns.
*
* @param \Chess\Variant\AbstractPiece $bishop
* @param string $sqColor
*/
private function countBlockingPawns(AbstractPiece $bishop, string $sqColor): int
{
$count = 0;
Expand Down

0 comments on commit cc0adcc

Please sign in to comment.