Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Finish off the tests for the scholar's mate

  • Loading branch information...
commit b0ab65dc2ed13f907738585a23df70a23ff57239 1 parent 101f8db
@hnrysmth authored
View
25 features/scholars_mate.feature
@@ -60,3 +60,28 @@ Feature: Scholar's Mate
| | | | | | | | |
| ♙ | ♙ | ♙ | ♙ | | ♙ | ♙ | ♙ |
| ♖ | ♘ | ♗ | | ♔ | | ♘ | ♖ |
+
+ Scenario: Move 6
+ When I move "8766"
+ Then the board should look like this
+ | ♜ | | ♝ | ♛ | ♚ | ♝ | | ♜ |
+ | ♟ | ♟ | ♟ | ♟ | | ♟ | ♟ | ♟ |
+ | | | ♞ | | | ♞ | | |
+ | | | | | ♟ | | | ♕ |
+ | | | ♗ | | ♙ | | | |
+ | | | | | | | | |
+ | ♙ | ♙ | ♙ | ♙ | | ♙ | ♙ | ♙ |
+ | ♖ | ♘ | ♗ | | ♔ | | ♘ | ♖ |
+
+ Scenario: Move 7
+ When I move "5876"
+ Then the board should look like this
+ | ♜ | | ♝ | ♛ | ♚ | ♝ | | ♜ |
+ | ♟ | ♟ | ♟ | ♟ | | ♕ | ♟ | ♟ |
+ | | | ♞ | | | ♞ | | |
+ | | | | | ♟ | | | |
+ | | | ♗ | | ♙ | | | |
+ | | | | | | | | |
+ | ♙ | ♙ | ♙ | ♙ | | ♙ | ♙ | ♙ |
+ | ♖ | ♘ | ♗ | | ♔ | | ♘ | ♖ |
+ And it should be checkmate
View
8 features/step_definitions/chess.js
@@ -85,7 +85,15 @@ module.exports = function () {
}
}
}
+ callback();
+ });
+ this.Then(/^it should be checkmate$/, function(callback) {
+ var positionCount = chessGame.game.positions.length;
+ var lastPosition = chessGame.game.positions[positionCount - 1];
+ if (lastPosition.status !== 'checkmate') {
+ callback.fail('Checkmate expected, ' + lastPosition.status + ' found');
+ }
callback();
});
View
5 src/container.js
@@ -104,7 +104,10 @@ define([
return new CheckAnalysis(
this['move.generator.pawn'](),
this['move.generator.knight'](),
- this['move.generator.king']()
+ this['move.generator.king'](),
+ this['move.generator.bishop'](),
+ this['move.generator.rook'](),
+ this['move.generator.queen']()
);
};
Please sign in to comment.
Something went wrong with that request. Please try again.