Nantes Université
Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
É
Échecs féeriques
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de conteneur
Registre de modèles
Opération
Environnements
Surveillance
Incidents
Service d'assistance
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Jessica RADAFY
Échecs féeriques
Validations
ea0c65f9
Valider
ea0c65f9
rédigé
il y a 5 ans
par
Enora LANGARD
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Mise à jour
parent
8938bc3b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/main/ts/move-validation.ts
+1
-1
1 ajout, 1 suppression
src/main/ts/move-validation.ts
src/test/ts/empress-move-validation.spec.ts
+71
-5
71 ajouts, 5 suppressions
src/test/ts/empress-move-validation.spec.ts
avec
72 ajouts
et
6 suppressions
src/main/ts/move-validation.ts
+
1
−
1
Voir le fichier @
ea0c65f9
...
@@ -102,7 +102,7 @@ export function queenMove(board: Chessboard, move: Move): boolean {
...
@@ -102,7 +102,7 @@ export function queenMove(board: Chessboard, move: Move): boolean {
*/
*/
export
function
empressMove
(
board
:
Chessboard
,
move
:
Move
):
boolean
{
export
function
empressMove
(
board
:
Chessboard
,
move
:
Move
):
boolean
{
// #TODO: Implement this function
// #TODO: Implement this function
return
true
;
return
move
.
from
.
rank
===
move
.
to
.
rank
;
}
}
/**
/**
...
...
This diff is collapsed.
Cliquez pour l'agrandir.
src/test/ts/empress-move-validation.spec.ts
+
71
−
5
Voir le fichier @
ea0c65f9
import
{
Expect
,
Test
,
Setup
}
from
"
alsatian
"
;
import
{
Expect
,
Test
,
Setup
}
from
"
alsatian
"
;
import
{
Chessboard
,
createEmptyChessboard
,
putPiece
}
from
'
../../main/ts/chessboard
'
;
import
*
as
isPossible
from
'
../../main/ts/move-validation
'
import
*
as
pieces
from
'
../../main/ts/piece
'
import
{
Chessboard
,
createEmptyChessboard
,
putPiece
,
pieceAtPosition
}
from
'
../../main/ts/chessboard
'
;
import
{
Position
,
position
}
from
'
../../main/ts/position
'
;
import
{
Move
,
move
}
from
'
../../main/ts/movements
'
;
let
chessboard
:
Chessboard
;
let
chessboard
:
Chessboard
;
const
positionA4
:
Position
=
position
(
0
,
3
)
// A4
const
positionA5
:
Position
=
position
(
0
,
4
)
// A5
const
positionA6
:
Position
=
position
(
0
,
5
)
// A6
const
positionA7
:
Position
=
position
(
0
,
6
)
// A7
const
positionA8
:
Position
=
position
(
0
,
7
)
// A8
const
positionB1
:
Position
=
position
(
1
,
0
)
// B1
const
positionB2
:
Position
=
position
(
1
,
1
)
// B2
const
positionB3
:
Position
=
position
(
1
,
2
)
// B3
const
positionB5
:
Position
=
position
(
1
,
4
)
// B5
const
positionB6
:
Position
=
position
(
1
,
5
)
// B6
const
positionC3
:
Position
=
position
(
2
,
1
)
// C3
const
positionC4
:
Position
=
position
(
2
,
3
)
// C4
const
positionC5
:
Position
=
position
(
2
,
4
)
// C5
const
positionC6
:
Position
=
position
(
2
,
5
)
// C6
const
positionC7
:
Position
=
position
(
2
,
6
)
// C7
const
positionD1
:
Position
=
position
(
3
,
0
)
// D1
const
positionD2
:
Position
=
position
(
3
,
1
)
// D2
const
positionD3
:
Position
=
position
(
3
,
2
)
// D3
const
positionD4
:
Position
=
position
(
3
,
3
)
// D4
const
positionD5
:
Position
=
position
(
3
,
4
)
// D5
const
positionD6
:
Position
=
position
(
3
,
5
)
// D6
const
positionD7
:
Position
=
position
(
3
,
6
)
// D7
const
positionE1
:
Position
=
position
(
4
,
0
)
// E1
const
positionE4
:
Position
=
position
(
4
,
3
)
// E4
const
positionE8
:
Position
=
position
(
4
,
7
)
// E8
const
positionF1
:
Position
=
position
(
5
,
0
)
// F1
const
positionF2
:
Position
=
position
(
5
,
1
)
// F2
const
positionF6
:
Position
=
position
(
5
,
5
)
// F6
const
positionF7
:
Position
=
position
(
5
,
6
)
// F7
const
positionG3
:
Position
=
position
(
6
,
2
)
// G3
const
positionG5
:
Position
=
position
(
6
,
4
)
// G5
const
positionH1
:
Position
=
position
(
7
,
0
)
// H1
const
positionH3
:
Position
=
position
(
7
,
2
)
// H3
const
positionH4
:
Position
=
position
(
7
,
3
)
// H4
const
positionH5
:
Position
=
position
(
7
,
4
)
// H5
const
positionH7
:
Position
=
position
(
7
,
6
)
// H7
// Horizontal moves
const
moveE4_H4
:
Move
=
move
(
positionE4
,
positionH4
);
const
moveE4_A4
:
Move
=
move
(
positionE4
,
positionA4
);
// Vertical moves
const
moveE4_E1
:
Move
=
move
(
positionE4
,
positionE1
);
const
moveE4_E8
:
Move
=
move
(
positionE4
,
positionE8
);
export
class
TestEmpressMoves
{
export
class
TestEmpressMoves
{
@
Setup
@
Setup
beforeEach
()
{
beforeEach
()
{
// TODO:
chessboard
=
createEmptyChessboard
();
// Initialize an empty chessboard
// Place a white Empress on E4
//La variable "positionE4" a été crée au début du module pour simplifier le code des tests
//Place une Impératrice sur la case E4 de l'échiquier vide
putPiece
(
chessboard
,
positionE4
,
pieces
.
blackEmpress
)
}
}
@
Test
(
"
An Empress can move horizontally
"
)
@
Test
(
"
An Empress can move horizontally
"
)
testCanMoveHorizontally
()
{
testCanMoveHorizontally
()
{
Expect
(
isPossible
.
empressMove
(
chessboard
,
moveE4_H4
)).
toBeTruthy
();
Expect
(
isPossible
.
empressMove
(
chessboard
,
moveE4_A4
)).
toBeTruthy
();
// TODO:
// TODO:
// Check the following moves are possible: moveE4_H4, moveE4_A4
// Check the following moves are possible: moveE4_H4, moveE4_A4
}
}
@
Test
(
"
A Empress can move vertically
"
)
@
Test
(
"
A Empress can move vertically
"
)
testCanMoveVertically
()
{
testCanMoveVertically
()
{
// TODO:
Expect
(
isPossible
.
empressMove
(
chessboard
,
moveE4_E8
)).
toBeTruthy
();
Expect
(
isPossible
.
empressMove
(
chessboard
,
moveE4_E1
)).
toBeTruthy
();
// Check the following moves are possible: moveE4_E1, moveE4_E8
// Check the following moves are possible: moveE4_E1, moveE4_E8
}
}
...
@@ -78,3 +142,5 @@ export class TestEmpressMoves {
...
@@ -78,3 +142,5 @@ export class TestEmpressMoves {
// Check the move moveE4_E1 is impossible
// Check the move moveE4_E1 is impossible
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter