Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Groupe 16
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Paul Ripault
Groupe 16
Commits
053092f5
Commit
053092f5
authored
4 years ago
by
Francois .D
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into Francois
parents
37a43672
7b402268
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main/Affichage.java
+1
-1
1 addition, 1 deletion
src/main/Affichage.java
src/main/Interface.java
+5
-41
5 additions, 41 deletions
src/main/Interface.java
src/main/Main.java
+19
-15
19 additions, 15 deletions
src/main/Main.java
with
25 additions
and
57 deletions
src/main/Affichage.java
+
1
−
1
View file @
053092f5
package
main
;
public
class
Affichage
{
public
static
void
affichage
(
Plateau
plateau
){
public
void
affichage
(
Plateau
plateau
){
for
(
int
i
=
0
;
i
<
plateau
.
getPlateau
().
length
*
5
;
i
++)
{
...
...
This diff is collapsed.
Click to expand it.
src/main/Interface.java
+
5
−
41
View file @
053092f5
...
...
@@ -3,6 +3,7 @@ package main;
import
units.Unite
;
public
class
Interface
{
private
static
Affichage
a
=
new
Affichage
();
private
static
int
rep
=
0
;
public
static
int
start
()
{
System
.
out
.
println
(
"Bienvenu sur Game of Crown"
);
...
...
@@ -18,52 +19,15 @@ public class Interface {
}
public
static
void
tourDeJeu
(
Plateau
plateau
,
Joueur
j1
)
{
rep
=-
1
;
Affichage
.
affichage
(
plateau
);
a
.
affichage
(
plateau
);
System
.
out
.
println
(
"Choissisez l'unité que vous voulez déplacer"
);
if
(
j1
.
getArmee
().
size
()!=
0
)
{
for
(
int
i
=
0
;
i
<
j1
.
getArmee
().
size
();
i
++)
{
System
.
out
.
println
(
i
+
1
+
": "
+
j1
.
getArmee
().
get
(
i
).
toString
());
}
Unite
u
=
j1
.
getArmee
().
get
(
Scan
.
scan
(
j1
.
getArmee
().
size
()-
1
));
System
.
out
.
println
(
"vous pouvez..."
);
if
(
u
.
getX
()>
0
)
{
if
(
plateau
.
getCase
(
u
.
getX
()-
1
,
u
.
getY
()).
getUnite
()!=
null
){
System
.
out
.
println
(
"1: Combattre l'unité au-dessus"
);
}
else
{
System
.
out
.
println
(
"1: Se déplacer vers le haut"
);
}
}
if
(
u
.
getX
()<
plateau
.
getPlateau
().
length
*
5
)
{
if
(
plateau
.
getCase
(
u
.
getX
()+
1
,
u
.
getY
()).
getUnite
()!=
null
){
System
.
out
.
println
(
"2: Combattre l'unité en bas"
);
}
else
{
System
.
out
.
println
(
"2: Se déplacer vers le bas"
);
}
}
if
(
u
.
getY
()<
plateau
.
getPlateau
().
length
*
5
)
{
if
(
plateau
.
getCase
(
u
.
getX
(),
u
.
getY
()+
1
).
getUnite
()!=
null
){
System
.
out
.
println
(
"3: Combattre l'unité à droite"
);
}
else
{
System
.
out
.
println
(
"3: Se déplacer vers la droite"
);
}
}
if
(
u
.
getY
()>
0
)
{
if
(
plateau
.
getCase
(
u
.
getX
(),
u
.
getY
()-
1
).
getUnite
()!=
null
){
System
.
out
.
println
(
"4: Combattre l'unité à gauche"
);
}
else
{
System
.
out
.
println
(
"4: Se déplacer vers la gauche"
);
}
}
rep
=
Scan
.
scan
(
4
);
if
(
rep
==
1
)
{
u
.
move
(
'z'
);
}
else
if
(
rep
==
2
)
{
u
.
move
(
's'
);
}
else
if
(
rep
==
3
)
{
u
.
move
(
'd'
);
}
else
if
(
rep
==
4
)
{
u
.
move
(
'q'
);
}
Unite
u
=
j1
.
getArmee
().
get
(
Scan
.
scan
(
j1
.
getArmee
().
size
())-
1
);
u
.
move
(
Main
.
deplacement
());
a
.
affichage
(
plateau
);
}
else
{
System
.
out
.
println
(
"Aucune unité disponible"
);
}
...
...
This diff is collapsed.
Click to expand it.
src/main/Main.java
+
19
−
15
View file @
053092f5
...
...
@@ -7,8 +7,11 @@ import units.Paysant;
public
class
Main
{
private
static
Joueur
winner
=
new
Joueur
(
"Winner"
);
private
int
actionPoint
;
static
Main
m
=
new
Main
();
public
static
void
main
(
String
[]
args
)
{
Affichage
a
=
new
Affichage
();
/*
* Region[][] regions = new Region[6][6]; for(int i = 0; i<regions.length; i++)
* { for(int j = 0; j<regions[i].length; j++) { regions[i][j] = new Region(); }
...
...
@@ -23,21 +26,20 @@ public class Main {
plateau
.
getCase
(
x
,
y
).
setUnite
(
new
Paysant
(
x
,
y
,
plateau
,
winner
));
winner
.
getArmee
().
get
(
0
).
getPlateau
().
getRegion
(
0
,
0
).
changeToCamp
();
Affichage
.
affichage
(
plateau
);
while
(
y
<
30
)
{
winner
.
getArmee
().
get
(
0
).
move
(
deplacement
());
a
.
affichage
(
plateau
);
/*
while(y<30) {
winner.getArmee().get(0).move(deplacement());
*/
System
.
out
.
println
(
'\n'
);
//winner.getArmee().get(0).teleporte();
Affichage
.
affichage
(
plateau
);
}
Menu
(
plateau
);
a
.
affichage
(
plateau
);
plateau
.
getCase
(
12
,
0
);
Affichage
.
affichage
(
plateau
);
//M
enu();
a
.
affichage
(
plateau
);
m
.
m
enu
(
plateau
);
}
public
static
void
M
enu
(
Plateau
plateau
)
{
public
void
m
enu
(
Plateau
plateau
)
{
int
continuer
=
2
;
while
(
continuer
!=
3
)
{
while
(
continuer
==
2
)
{
...
...
@@ -45,7 +47,7 @@ public class Main {
}
if
(
continuer
!=
3
)
{
continuer
=
2
;
Interface
.
tourDeJeu
(
plateau
,
winner
);
m
.
game
(
new
Joueur
[]{
winner
,
null
},
plateau
);
}
}
}
...
...
@@ -60,19 +62,21 @@ public class Main {
return
sc
.
next
().
charAt
(
0
);
}
private
Joueur
G
ame
(
Joueur
[]
joueurs
)
{
private
Joueur
g
ame
(
Joueur
[]
joueurs
,
Plateau
plateau
)
{
boolean
gameEnd
=
false
;
while
(
gameEnd
)
{
while
(
!
gameEnd
)
{
for
(
Joueur
currentPlayer
:
joueurs
)
{
setActionPoint
(
currentPlayer
);
Tour
(
currentPlayer
,
actionPoint
);
Tour
(
currentPlayer
,
actionPoint
,
plateau
);
}
}
return
getWinner
();
}
public
void
Tour
(
Joueur
currentPlayer
,
int
actionPoint
)
{
public
void
Tour
(
Joueur
currentPlayer
,
int
actionPoint
,
Plateau
plateau
)
{
for
(
int
i
=
0
;
i
<
actionPoint
;
i
++)
{
Interface
.
tourDeJeu
(
plateau
,
currentPlayer
);
}
}
public
void
setActionPoint
(
int
actionPoint
)
{
...
...
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