-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the bad bishop evaluation #208
Comments
Let's try to define what a bad bishop is in terms of the pawns on its side only, this way it'll be differentiated from a blocked bishop I suppose. Here are some hints:
Thus, what about creating a bunch of tests with specific results for chess positions according to these hints? For further information please visit: Happy learning and coding! |
This is a suggested result for the following sample position: White's bishop is being blocked by 0 pawns while Black's bishop is blocked by 5 pawns. <?php
namespace Chess\Tests\Unit\Eval;
use Chess\Eval\BadBishopEval;
use Chess\FEN\StrToBoard;
use Chess\Tests\AbstractUnitTestCase;
class BadBishopEvalTest extends AbstractUnitTestCase
{
/**
* @test
*/
public function position_01()
{
$fen = '8/5b2/p2k4/1p1p1p1p/1P1K1P1P/2P1PB2/8/8 w - - 0 1';
$board = (new StrToBoard($fen))->create();
$expected = [
'w' => 0,
'b' => 5,
];
$badBishopEval = (new BadBishopEval($board))->eval();
$this->assertSame($expected, $badBishopEval);
}
} |
Great! Thanks @programarivm for that example. I will prepare solution for it. Happy learning and coding! |
Thanks! Shall we do it test by test? I just found this position with a bad bishop on c2 and was wondering which expected result would make sense. Keep it up and happy learning and coding. |
@MarcinGladkowski the samples have been updated with an expected result. |
A new evaluation feature needs to be implemented in order to keep track of bad bishops. A bad bishop is a bishop whose mobility is restricted by its own pawns. Sometimes it becomes such a bad piece that it's like playing with one less piece.
Thus, a new file named
BadBishopEvaluation.php
needs to be implemented in a similar way as other evaluation features, for example:Also
Chess\Evaluation\BadBishopEvaluation
should be TDDed accordingly:With the new feature implemented, we'll be able to display a nice bar chart pointing out whether or not a bad bishop is found on the chessboard.
For further information please visit:
Keep it up, and happy coding and learning!
The text was updated successfully, but these errors were encountered: