Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Fardale
Prog2
Commits
6d436562
Commit
6d436562
authored
Mar 27, 2015
by
Fardale
Browse files
Maintenant ca marche : erreur a la con
parent
6512fa7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
boum.scala
View file @
6d436562
...
...
@@ -144,7 +144,7 @@ class Demineur extends Jeu[MonBouton] {
if
(
premierCoup
){
premierCoup
=
false
}
var
voisin
=
voisinEtendu
(
x
,
y
)
var
voisin
=
(
voisinEtendu
(
x
,
y
)
:::(
Nil
))
for
(
plop
<-
voisin
)
{
var
(
vx
,
vy
)
=
plop
if
(
boutons
(
vx
)(
vy
).
estLibre
&&
!
boutons
(
vx
)(
vy
).
mines
){
clique_action
(
vx
,
vy
)}}
...
...
jeu.scala
View file @
6d436562
...
...
@@ -22,31 +22,30 @@ abstract class Jeu[T<:Button] {
def
victoire
()
:
Boolean
def
voisinDirect
(
x
:
Int
,
y
:
Int
){
def
voisinDirect
(
x
:
Int
,
y
:
Int
)
=
{
var
voisin
=
List
[(
Int
,
Int
)]()
if
(
x
>
0
){
voisin
=
(
x
-
1
,
y
)
::
voisin
}
if
(
x
<
tailleX
){
voisin
=
(
x
+
1
,
y
)
::
voisin
}
if
(
x
>
0
){
voisin
=
(
x
,
y
-
1
)
::
voisin
}
if
(
x
<
tailleY
){
voisin
=
(
x
,
y
+
1
)
::
voisin
}
if
(
x
<
tailleY
-
1
){
voisin
=
(
x
,
y
+
1
)
::
voisin
}
voisin
}
def
voisinEtendu
(
x
:
Int
,
y
:
Int
){
def
voisinEtendu
(
x
:
Int
,
y
:
Int
)
:
List
[(
Int
,
Int
)]
=
{
var
voisin
=
List
[(
Int
,
Int
)]()
if
(
x
>
0
){
voisin
=
(
x
-
1
,
y
)
::
voisin
if
(
y
>
0
){
voisin
=
=
(
x
-
1
,
y
-
1
)
::
voisin
}
if
(
y
<
tailleY
){
voisin
=
=
(
x
-
1
,
y
+
1
)
::
voisin
}
if
(
y
>
0
){
voisin
=
(
x
-
1
,
y
-
1
)
::
voisin
}
if
(
y
<
tailleY
-
1
){
voisin
=
(
x
-
1
,
y
+
1
)
::
voisin
}
}
if
(
x
<
tailleX
){
if
(
x
<
tailleX
-
1
){
voisin
=
(
x
+
1
,
y
)
::
voisin
if
(
y
>
0
){
voisin
=
=
(
x
+
1
,
y
-
1
)
::
voisin
}
if
(
y
<
tailleY
){
voisin
=
=
(
x
+
1
,
y
+
1
)
::
voisin
}
if
(
y
>
0
){
voisin
=
(
x
+
1
,
y
-
1
)
::
voisin
}
if
(
y
<
tailleY
-
1
){
voisin
=
(
x
+
1
,
y
+
1
)
::
voisin
}
}
if
(
y
>
0
){
voisin
=
(
x
,
y
-
1
)
::
voisin
}
if
(
y
<
tailleY
){
voisin
=
(
x
,
y
+
1
)
::
voisin
}
if
(
y
<
tailleY
-
1
){
voisin
=
(
x
,
y
+
1
)
::
voisin
};
voisin
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment