public function testInsufficientMaterial() { $chess = new ChessPublicator(); $this->assertSame($chess->insufficientMaterial(), false); // k vs k $chess->clear(); $chess->put(['type' => Chess::KING, 'color' => Chess::WHITE], 'e1'); $chess->put(['type' => Chess::KING, 'color' => Chess::BLACK], 'e8'); $this->assertSame($chess->insufficientMaterial(), true); // k vs kn $chess->clear(); $chess->put(['type' => Chess::KING, 'color' => Chess::WHITE], 'e1'); $chess->put(['type' => Chess::KING, 'color' => Chess::BLACK], 'e8'); $chess->put(['type' => Chess::KNIGHT, 'color' => Chess::WHITE], 'e4'); $this->assertSame($chess->insufficientMaterial(), true); // k vs kb $chess->clear(); $chess->put(['type' => Chess::KING, 'color' => Chess::WHITE], 'e1'); $chess->put(['type' => Chess::KING, 'color' => Chess::BLACK], 'e8'); $chess->put(['type' => Chess::BISHOP, 'color' => Chess::WHITE], 'e4'); $this->assertSame($chess->insufficientMaterial(), true); // k vs k(b){0,} << bishop(s) in same color $chess->clear(); $chess->put(['type' => Chess::KING, 'color' => Chess::WHITE], 'e1'); $chess->put(['type' => Chess::KING, 'color' => Chess::BLACK], 'e8'); $chess->put(['type' => Chess::BISHOP, 'color' => Chess::BLACK], 'e5'); $this->assertSame($chess->insufficientMaterial(), true); $chess->put(['type' => Chess::BISHOP, 'color' => Chess::BLACK], 'd6'); $this->assertSame($chess->insufficientMaterial(), true); $chess->put(['type' => Chess::BISHOP, 'color' => Chess::BLACK], 'c7'); $this->assertSame($chess->insufficientMaterial(), true); $chess->put(['type' => Chess::BISHOP, 'color' => Chess::BLACK], 'b8'); $this->assertSame($chess->insufficientMaterial(), true); }