Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
projetEchecs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
NASR Alexis
projetEchecs
Commits
9398205f
Commit
9398205f
authored
Nov 23, 2020
by
Alexis Nasr
Browse files
Options
Downloads
Patches
Plain Diff
modification de TestChess, Legal remplacé par Playable
parent
9088838b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
TestChess.java
+6
-6
6 additions, 6 deletions
TestChess.java
with
6 additions
and
6 deletions
TestChess.java
+
6
−
6
View file @
9398205f
...
@@ -7,17 +7,17 @@ public class TestChess{
...
@@ -7,17 +7,17 @@ public class TestChess{
boolean
result
;
boolean
result
;
/* Test de déplacements autorisés selon les regles de pièces */
/* Test de déplacements autorisés selon les regles de pièces */
System
.
out
.
println
(
"
legal
moves"
);
System
.
out
.
println
(
"
authorized
moves"
);
System
.
out
.
print
(
"test 1 : "
);
System
.
out
.
print
(
"test 1 : "
);
result
=
test
Legal
Move
(
"boardConfigurationFiles/FullBoard.txt"
,
new
Coordinates
(
0
,
1
),
new
Coordinates
(
0
,
2
));
result
=
test
Authorized
Move
(
"boardConfigurationFiles/FullBoard.txt"
,
new
Coordinates
(
0
,
1
),
new
Coordinates
(
0
,
2
));
if
(
result
==
true
)
System
.
out
.
println
(
"pass"
);
else
System
.
out
.
println
(
"fail"
);
if
(
result
==
true
)
System
.
out
.
println
(
"pass"
);
else
System
.
out
.
println
(
"fail"
);
System
.
out
.
print
(
"test 2 : "
);
System
.
out
.
print
(
"test 2 : "
);
result
=
test
Legal
Move
(
"boardConfigurationFiles/FullBoard.txt"
,
new
Coordinates
(
0
,
1
),
new
Coordinates
(
0
,
4
));
result
=
test
Authorized
Move
(
"boardConfigurationFiles/FullBoard.txt"
,
new
Coordinates
(
0
,
1
),
new
Coordinates
(
0
,
4
));
if
(
result
==
false
)
System
.
out
.
println
(
"pass"
);
else
System
.
out
.
println
(
"fail"
);
if
(
result
==
false
)
System
.
out
.
println
(
"pass"
);
else
System
.
out
.
println
(
"fail"
);
/* Test de déplacements
legal
sur l'échiquier actuel, selon les regles du jeu */
/* Test de déplacements
jouables
sur l'échiquier actuel, selon les regles du jeu */
System
.
out
.
println
(
"playable moves"
);
System
.
out
.
println
(
"playable moves"
);
System
.
out
.
print
(
"test 1 : "
);
System
.
out
.
print
(
"test 1 : "
);
result
=
testPlayableMove
(
"boardConfigurationFiles/FullBoard.txt"
,
new
Coordinates
(
0
,
1
),
new
Coordinates
(
0
,
2
));
result
=
testPlayableMove
(
"boardConfigurationFiles/FullBoard.txt"
,
new
Coordinates
(
0
,
1
),
new
Coordinates
(
0
,
2
));
...
@@ -35,7 +35,7 @@ public class TestChess{
...
@@ -35,7 +35,7 @@ public class TestChess{
}
}
public
static
boolean
test
Legal
Move
(
String
filename
,
Coordinates
origin
,
Coordinates
destination
)
{
public
static
boolean
test
Authorized
Move
(
String
filename
,
Coordinates
origin
,
Coordinates
destination
)
{
ChessUI
ui
=
new
ChessUI
(
false
);
ChessUI
ui
=
new
ChessUI
(
false
);
Board
testBoard
=
new
Board
(
filename
,
new
Human
(
ui
,
ChessColor
.
WHITE
),
new
Human
(
ui
,
ChessColor
.
BLACK
));
Board
testBoard
=
new
Board
(
filename
,
new
Human
(
ui
,
ChessColor
.
WHITE
),
new
Human
(
ui
,
ChessColor
.
BLACK
));
Piece
testPiece
=
testBoard
.
getPiece
(
origin
);
Piece
testPiece
=
testBoard
.
getPiece
(
origin
);
...
@@ -43,7 +43,7 @@ public class TestChess{
...
@@ -43,7 +43,7 @@ public class TestChess{
System
.
out
.
println
(
"No Piece at :"
+
origin
);
System
.
out
.
println
(
"No Piece at :"
+
origin
);
return
false
;
return
false
;
}
}
return
testPiece
.
isMove
Legal
(
testBoard
,
destination
);
return
testPiece
.
isMove
Authorized
(
testBoard
,
destination
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment