Skip to content

Commit d35284a

Browse files
authored
Fix 4 pieces not in basic draw
Fix 4 pieces not in basic draw
2 parents fe2ee14 + 185fe1d commit d35284a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Tests/ChessGameTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,14 @@ public function testIsInBasicDrawKingAndTwoKnightsVsKing()
575575
$this->assertTrue($this->game->inBasicDraw());
576576
}
577577

578+
public function testIsNotInBasicDrawWith4pieces()
579+
{
580+
$startFen = '8/8/6B1/3k4/8/4K3/5Q2/8 w - -';
581+
582+
$this->game->resetGame($startFen);
583+
$this->assertFalse($this->game->inBasicDraw());
584+
}
585+
578586
public function testIsInCheckmate()
579587
{
580588
$startFen = '3k2R1/8/3K4/8/8/8/8/8 b - -';

src/Chess/Game/ChessGame.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,8 @@ public function inBasicDraw()
14531453
&& in_array($playerWith3Pieces[2], array('K', 'N'))) {
14541454
return true; //KNN vs K
14551455
}
1456+
1457+
return false;
14561458
}
14571459

14581460
$playerWith2Pieces = count($whitePieces) === 2 ? $whitePieces : $blackPieces;

0 commit comments

Comments
 (0)