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
4d42483c
Commit
4d42483c
authored
4 years ago
by
Maxime Wallart
Browse files
Options
Downloads
Plain Diff
update deplacements
parents
c979be3b
378678ca
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main/Direction.java
+0
-7
0 additions, 7 deletions
src/main/Direction.java
src/main/Main.java
+22
-3
22 additions, 3 deletions
src/main/Main.java
src/units/Unite.java
+6
-6
6 additions, 6 deletions
src/units/Unite.java
with
28 additions
and
16 deletions
src/main/Direction.java
deleted
100644 → 0
+
0
−
7
View file @
c979be3b
package
main
;
public
enum
Direction
{
HAUT
,
GAUCHE
,
BAS
,
DROITE
;
}
This diff is collapsed.
Click to expand it.
src/main/Main.java
+
22
−
3
View file @
4d42483c
package
main
;
package
main
;
import
java.util.Scanner
;
import
units.Paysant
;
import
units.Paysant
;
public
class
Main
{
public
class
Main
{
private
static
Joueur
winner
;
private
static
Joueur
winner
=
new
Joueur
(
"Winner"
)
;
private
int
actionPoint
;
private
int
actionPoint
;
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
@@ -18,10 +20,13 @@ public class Main {
...
@@ -18,10 +20,13 @@ public class Main {
Plateau
plateau
=
new
Plateau
();
Plateau
plateau
=
new
Plateau
();
int
x
=
11
;
int
x
=
11
;
int
y
=
0
;
int
y
=
1
0
;
plateau
.
getCase
(
x
,
y
).
setUnite
(
new
Paysant
(
x
,
y
,
plateau
,
winner
));
plateau
.
getCase
(
x
,
y
).
setUnite
(
new
Paysant
(
x
,
y
,
plateau
,
winner
));
//winner.ajoutUnit(plateau.getCase(x, y).getUnite());
Affichage
.
affichage
(
plateau
);
Affichage
.
affichage
(
plateau
);
plateau
.
getCase
(
x
,
y
).
getUnite
().
move
(
Direction
.
HAUT
);
//plateau.getCase(x, y).getUnite().move(deplacement());
System
.
out
.
println
(
winner
.
getArmee
().
get
(
0
));
winner
.
getArmee
().
get
(
0
).
move
(
deplacement
());
System
.
out
.
println
(
'\n'
);
System
.
out
.
println
(
'\n'
);
Affichage
.
affichage
(
plateau
);
Affichage
.
affichage
(
plateau
);
<<<<<<<
HEAD
<<<<<<<
HEAD
...
@@ -34,7 +39,21 @@ public class Main {
...
@@ -34,7 +39,21 @@ public class Main {
>>>>>>>
6
e6d8e1d075a8855972540815248afce1757f9e0
>>>>>>>
6
e6d8e1d075a8855972540815248afce1757f9e0
}
}
<<<<<<<
HEAD
public
Joueur
Game
(
Joueur
[]
joueurs
)
{
public
Joueur
Game
(
Joueur
[]
joueurs
)
{
=======
public
static
char
deplacement
()
{
Scanner
sc
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"Veuillez choisir une direction"
);
while
(!
sc
.
hasNext
(
"[zqsd]"
))
{
System
.
out
.
println
(
"Cette touche n'est pas acceptés, veuillez réessayer"
);
sc
.
next
();
}
return
sc
.
next
().
charAt
(
0
);
}
private
Joueur
Game
(
Joueur
[]
joueurs
)
{
>>>>>>>
Maxime
boolean
gameEnd
=
false
;
boolean
gameEnd
=
false
;
while
(
gameEnd
){
while
(
gameEnd
){
for
(
Joueur
currentPlayer
:
joueurs
)
{
for
(
Joueur
currentPlayer
:
joueurs
)
{
...
...
This diff is collapsed.
Click to expand it.
src/units/Unite.java
+
6
−
6
View file @
4d42483c
...
@@ -2,7 +2,6 @@ package units;
...
@@ -2,7 +2,6 @@ package units;
import
items.Items
;
import
items.Items
;
import
main.Case
;
import
main.Case
;
import
main.Direction
;
import
main.Event
;
import
main.Event
;
import
main.Joueur
;
import
main.Joueur
;
import
main.Plateau
;
import
main.Plateau
;
...
@@ -30,6 +29,7 @@ public abstract class Unite {
...
@@ -30,6 +29,7 @@ public abstract class Unite {
this
.
x
=
x
;
this
.
x
=
x
;
this
.
y
=
y
;
this
.
y
=
y
;
this
.
joueur
=
joueur
;
this
.
joueur
=
joueur
;
this
.
joueur
.
ajoutUnit
(
this
);
this
.
item
=
null
;
this
.
item
=
null
;
}
}
...
@@ -125,26 +125,26 @@ public abstract class Unite {
...
@@ -125,26 +125,26 @@ public abstract class Unite {
return
false
;
return
false
;
}
}
//à voir le type
//à voir le type
public
boolean
move
(
Direction
d
)
{
public
boolean
move
(
char
c
)
{
if
(
d
==
Direction
.
BAS
)
{
if
(
c
==
's'
)
{
if
(
updatePosition
(
x
+
1
,
y
))
{
if
(
updatePosition
(
x
+
1
,
y
))
{
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
return
true
;
return
true
;
}
}
}
}
else
if
(
d
==
Direction
.
DROITE
)
{
else
if
(
c
==
'd'
)
{
if
(
updatePosition
(
x
,
y
+
1
))
{
if
(
updatePosition
(
x
,
y
+
1
))
{
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
return
true
;
return
true
;
}
}
}
}
else
if
(
d
==
Direction
.
GAUCHE
)
{
else
if
(
c
==
'q'
)
{
if
(
updatePosition
(
x
,
y
-
1
))
{
if
(
updatePosition
(
x
,
y
-
1
))
{
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
return
true
;
return
true
;
}
}
}
}
else
if
(
d
==
Direction
.
HAUT
)
{
else
if
(
c
==
'z'
)
{
if
(
updatePosition
(
x
-
1
,
y
))
{
if
(
updatePosition
(
x
-
1
,
y
))
{
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
return
true
;
return
true
;
...
...
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