Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider 4c1bc5a0 rédigé par sunye's avatar sunye
Parcourir les fichiers

Empress should combien Rook + Knight moves

parent eaf6ffde
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -15,7 +15,7 @@ Dans notre cas, notre jeu aura les pièces suivantes:
- *Roi*, *Reine* et *Pion* des échecs traditionnels.
- Le *Chameau* à la place du Chevalier. Le Chameau se déplace comme un cavalier mais avec une case supplémentaire. Il saute de trois cases horizontalement et d'une case verticalement ou de trois cases verticalement et d'une case horizontalement.
- La *Princesse* à la place du Fou. La Princesse combine les mouvements d'un Cavalier et d'un Fou.
- L'*Impératrice* à la place de la Tour. L'Impératrice combine les mouvements d'une Tout et d'un Fou.
- L'*Impératrice* à la place de la Tour. L'Impératrice combine les mouvements d'une Tour et d'un Chevalier.
== Préparation
......
......@@ -94,8 +94,12 @@ export function queenMove(board: Chessboard, move: Move): boolean {
/**
* Checks whether a Empress can perform a given move.
* An empress can move any number of squares along a rank or file,
* but cannot leap over other pieces.
* An Empress can move any number of squares along a rank or file,
* but cannot leap over other pieces.
* An Empress can also move to any of the closest squares that are not on the
* same rank, file, or diagonal. (Thus the move forms an "L"-shape:
* two squares vertically and one square horizontally, or two
* squares horizontally and one square vertically.)
*
* @param board The chessboard of the current game
* @param move
......
......@@ -8,16 +8,27 @@ export class TestCamelMoves {
beforeEach() {
// TODO:
// Initialize an empty chessboard
// Place a white Camel on E4
}
@Test("A Camel can move three squares horizontally and one square vertically")
testCanMoveThreeHorizontalAndOneVertical() {
// TODO:
// Check the following moves are possible:
// - moveE4_H3
// - moveE4_H5
// - moveE4_B3
// - moveE4_B5
}
@Test("A Camel can move three squares vertically and one square horizontally")
testCanMoveThreeVerticalAndOneHorizontal() {
// TODO:
// Check the following moves are possible:
// - moveE4_F1
// - moveE4_F7
// - moveE4_D1
// - moveE4_D7
}
@Test("A Camel can leap other pieces")
......
......@@ -11,7 +11,7 @@ export class TestEmpressMoves {
// Place a white Empress on E4
}
@Test("A Empress can move horizontally")
@Test("An Empress can move horizontally")
testCanMoveHorizontally() {
// TODO:
// Check the following moves are possible: moveE4_H4, moveE4_A4
......@@ -23,10 +23,30 @@ export class TestEmpressMoves {
// Check the following moves are possible: moveE4_E1, moveE4_E8
}
@Test("A Empress can move diagonally")
testCanMoveDiagonally() {
// TODO:
@Test("An Empress can move three squares horizontally and one square vertically")
testCanMoveTwoHorizontalAndOneVertical() {
// TODO
// Check the following moves are possible:
// moveE4_G3
// moveE4_G5
// moveE4_C3
// moveE4_C5
}
@Test("An Empress can move three squares vertically and one square horizontally")
testCanMoveTwoVerticalAndOneHorizontal() {
// TODO
// moveE4_F2
// moveE4_F6
// moveE4_D2
// moveE4_D6
}
@Test("A Empress cannot move diagonally")
testCannotMoveDiagonally() {
// TODO:
// Check the following moves are impossible:
// moveE4_A8, moveE4_B1, moveE4_H7, moveE4_H1
}
......@@ -44,10 +64,17 @@ export class TestEmpressMoves {
// Check the move moveE4_H4 is impossible
}
@Test("A Empress cannot leap other pieces")
testCannotLeap() {
@Test("A Empress cannot leap other pieces, when moving horizontally")
testCannotLeapHorizontally() {
// TODO:
// Place a black Pawn on F4
// Check the move moveE4_H4 is impossible
}
@Test("A Empress cannot leap other pieces, when moving horizontally")
testCannotLeapvertically() {
// TODO:
// Place a black Pawn on E3
// Check the move moveE4_E1 is impossible
}
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter