short promoteTo, i.e. q instead of queen
This commit is contained in:
@@ -47,10 +47,10 @@ class Board0x88Config{
|
||||
);
|
||||
|
||||
public static $pieceAbbr = array(
|
||||
'Q' => 'queen',
|
||||
'R' => 'rook',
|
||||
'N' => 'knight',
|
||||
'B' => 'bishop'
|
||||
'Q' => 'q',
|
||||
'R' => 'r',
|
||||
'N' => 'n',
|
||||
'B' => 'b'
|
||||
);
|
||||
|
||||
public static $numberToSquareMapping = array(
|
||||
@@ -137,12 +137,12 @@ class Board0x88Config{
|
||||
);
|
||||
|
||||
public static $typeToNumberMapping = array(
|
||||
'pawn' => 0x01,
|
||||
'knight' => 0x02,
|
||||
'king' => 0x03,
|
||||
'bishop' => 0x05,
|
||||
'rook' => 0x06,
|
||||
'queen' => 0x07
|
||||
'p' => 0x01,
|
||||
'n' => 0x02,
|
||||
'k' => 0x03,
|
||||
'b' => 0x05,
|
||||
'r' => 0x06,
|
||||
'q' => 0x07
|
||||
|
||||
);
|
||||
|
||||
|
@@ -1404,7 +1404,7 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
|
||||
$parser = $this->getParser($fen);
|
||||
|
||||
// when
|
||||
$parser->move(array('from' => 'c7', 'to' => 'c8', 'promoteTo' => 'queen'));
|
||||
$parser->move(array('from' => 'c7', 'to' => 'c8', 'promoteTo' => 'q'));
|
||||
$newFen = $parser->getFen();
|
||||
$expectedFen = '2Q4k/6p1/7p/8/8/4p3/8/7K b - - 0 1';
|
||||
// then
|
||||
@@ -1414,8 +1414,8 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
|
||||
|
||||
$parser = $this->getParser($fen);
|
||||
// when
|
||||
$parser->move(array('from' => 'c2', 'to' => 'c1', 'promoteTo' => 'queen'));
|
||||
$newFen = $parser->getFen(array('from' => 'c2', 'to' => 'c1', 'promoteTo' => 'queen'));
|
||||
$parser->move(array('from' => 'c2', 'to' => 'c1', 'promoteTo' => 'q'));
|
||||
$newFen = $parser->getFen(array('from' => 'c2', 'to' => 'c1', 'promoteTo' => 'q'));
|
||||
$expectedFen = '7k/8/8/8/8/8/8/2q4K w - - 0 2';
|
||||
// then
|
||||
$this->assertEquals($expectedFen, $newFen);
|
||||
@@ -1648,7 +1648,7 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
|
||||
$fen = '8/P6k/8/8/8/8/8/5K2 w - - 0 1';
|
||||
$parser = $this->getParser($fen);
|
||||
// when
|
||||
$moves = $parser->getPiecesInvolvedInMove(array('from' => 'a7', 'to' => 'a8', 'promoteTo' => 'queen'));
|
||||
$moves = $parser->getPiecesInvolvedInMove(array('from' => 'a7', 'to' => 'a8', 'promoteTo' => 'q'));
|
||||
$this->assertEquals(2, count($moves));
|
||||
|
||||
}
|
||||
@@ -1691,7 +1691,7 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
|
||||
'3k4/4p3/5p2/6p1/7p/8/8/R3K3 w Q - 0 1'
|
||||
|
||||
);
|
||||
$moves = array('e2e4', 'e5d6', array('from' => 'c7', 'to' => 'c8', 'promoteTo' => 'queen'), 'e1e8', 'f2f7', 'b7f7', 'b6d5', 'e1g1', 'e1c1');
|
||||
$moves = array('e2e4', 'e5d6', array('from' => 'c7', 'to' => 'c8', 'promoteTo' => 'q'), 'e1e8', 'f2f7', 'b7f7', 'b6d5', 'e1g1', 'e1c1');
|
||||
$expected = array('e4', 'exd6', 'c8=Q#', 'Rxe8+', 'Rfxf7', 'Rbxf7', 'N6xd5', 'O-O', 'O-O-O+');
|
||||
|
||||
for ($i = 0; $i < count($fens); $i++) {
|
||||
@@ -1725,7 +1725,7 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
|
||||
'3k4/4p3/5p2/6p1/7p/8/8/R3K3 w Q - 0 1'
|
||||
|
||||
);
|
||||
$moves = array('e2e4', 'e5d6', array('from' => 'c7', 'to' => 'c8', 'promoteTo' => 'queen'), 'e1e8', 'f2f7', 'b7f7', 'b6d5', 'e1g1', 'e1c1');
|
||||
$moves = array('e2e4', 'e5d6', array('from' => 'c7', 'to' => 'c8', 'promoteTo' => 'q'), 'e1e8', 'f2f7', 'b7f7', 'b6d5', 'e1g1', 'e1c1');
|
||||
$expected = array('e2-e4', 'e5xd6', 'c7-c8=Q#', 'Re1xe8+', 'Rf2xf7', 'Rb7xf7', 'Nb6xd5', 'O-O', 'O-O-O+');
|
||||
|
||||
for ($i = 0; $i < count($fens); $i++) {
|
||||
@@ -1781,7 +1781,7 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
|
||||
|
||||
// given
|
||||
$parser = $this->getParser('3r2k1/pp1r4/1b3Q1P/5B2/8/8/P2p1PK1/8 b - - 3 41');
|
||||
$parser->move(array('from' => 'd2', 'to' => 'd1', 'promoteTo' => 'queen'));
|
||||
$parser->move(array('from' => 'd2', 'to' => 'd1', 'promoteTo' => 'q'));
|
||||
|
||||
$expectedFen = '3r2k1/pp1r4/1b3Q1P/5B2/8/8/P4PK1/3q4 w - - 0 42';
|
||||
$fen = $parser->getFen();
|
||||
@@ -1800,7 +1800,7 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
|
||||
|
||||
// when
|
||||
$expectedFen = '6k1/8/8/8/8/8/7P/1q5K w - - 0 2';
|
||||
$parser->move(array('from' => 'b2', 'to' => 'b1', 'promoteTo' => 'queen'));
|
||||
$parser->move(array('from' => 'b2', 'to' => 'b1', 'promoteTo' => 'q'));
|
||||
|
||||
// then
|
||||
$this->assertEquals($expectedFen, $parser->getFen());
|
||||
@@ -1862,7 +1862,7 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
|
||||
// then
|
||||
$this->assertEquals('d2', $move['from']);
|
||||
$this->assertEquals('d1', $move['to']);
|
||||
$this->assertEquals('queen', $move['promoteTo']);
|
||||
$this->assertEquals('q', $move['promoteTo']);
|
||||
// Given
|
||||
$parser = $this->getParser('r1bqk1nr/ppp2ppp/1b1p2n1/3PP1N1/2B5/8/P4PPP/RNBQ1RK1 b kq - 2 11');
|
||||
// when
|
||||
@@ -1966,7 +1966,7 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
|
||||
|
||||
$notations = array('a8=R+', 'g8Q', 'axb1=R', 'b8');
|
||||
$colors = array('white', 'white', 'black', 'white');
|
||||
$expectedResults = array('rook', 'queen', 'rook', '');
|
||||
$expectedResults = array('r', 'q', 'r', '');
|
||||
|
||||
// when
|
||||
for ($i = 0; $i < count($notations); $i++) {
|
||||
|
Reference in New Issue
Block a user