Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Théo BOUTEMY
siam
Commits
1fc2c3d8
Commit
1fc2c3d8
authored
May 31, 2021
by
Pauline LEYRIT
Browse files
boite de dialogue
parent
0080b025
Changes
1
Hide whitespace changes
Inline
Side-by-side
appli2.py
View file @
1fc2c3d8
...
...
@@ -830,7 +830,76 @@ class Window(QMainWindow):
print
(
"le rhino {}+1"
.
format
(
i
))
self
.
pion_select
=
self
.
liste_rh_qg
[
i
]
self
.
pion_select_num
=
i
+
1
def
vainqueur
(
self
):
bool
=
False
m
=
self
.
mont_sorti
if
m
.
coords
[
0
]
==-
1
:
#la montagne est sortie du plateau
while
bool
==
False
:
#tant qu'on n'a pas trouvé le vainqueur
for
i
in
range
(
1
,
5
):
for
piece
in
self
.
ele
:
if
piece
.
coords
[
0
]
==
m
.
coords
[
0
]
+
i
and
piece
.
coords
[
1
]
==
m
.
coords
[
1
]
and
piece
.
orientation
==
'g'
:
winner
=
piece
bool
=
True
break
for
piece
in
self
.
rh
:
if
piece
.
coords
[
0
]
==
m
.
coords
[
0
]
+
i
and
piece
.
coords
[
1
]
==
m
.
coords
[
1
]
and
piece
.
orientation
==
'g'
:
winner
=
piece
bool
=
True
break
if
m
.
coords
[
0
]
==
5
:
#la montagne est sortie du plateau
while
bool
==
False
:
#tant qu'on n'a pas trouvé le vainqueur
for
i
in
range
(
1
,
5
):
for
piece
in
self
.
ele
:
if
piece
.
coords
[
0
]
==
m
.
coords
[
0
]
-
i
and
piece
.
coords
[
1
]
==
m
.
coords
[
1
]
and
piece
.
orientation
==
'd'
:
winner
=
piece
bool
=
True
break
for
piece
in
self
.
rh
:
if
piece
.
coords
[
0
]
==
m
.
coords
[
0
]
-
i
and
piece
.
coords
[
1
]
==
m
.
coords
[
1
]
and
piece
.
orientation
==
'd'
:
winner
=
piece
bool
=
True
break
if
m
.
coords
[
1
]
==-
1
:
#la montagne est sortie du plateau
while
bool
==
False
:
#tant qu'on n'a pas trouvé le vainqueur
for
i
in
range
(
1
,
5
):
for
piece
in
self
.
ele
:
if
piece
.
coords
[
1
]
==
m
.
coords
[
1
]
+
i
and
piece
.
coords
[
0
]
==
m
.
coords
[
0
]
and
piece
.
orientation
==
'h'
:
winner
=
piece
bool
=
True
break
for
piece
in
self
.
rh
:
if
piece
.
coords
[
1
]
==
m
.
coords
[
1
]
+
i
and
piece
.
coords
[
0
]
==
m
.
coords
[
0
]
and
piece
.
orientation
==
'h'
:
winner
=
piece
bool
=
True
break
if
m
.
coords
[
1
]
==
5
:
#la montagne est sortie du plateau
while
bool
==
False
:
#tant qu'on n'a pas trouvé le vainqueur
for
i
in
range
(
1
,
5
):
for
piece
in
self
.
ele
:
if
piece
.
coords
[
1
]
==
m
.
coords
[
1
]
-
i
and
piece
.
coords
[
0
]
==
m
.
coords
[
0
]
and
piece
.
orientation
==
'b'
:
winner
=
piece
bool
=
True
break
for
piece
in
self
.
rh
:
if
piece
.
coords
[
1
]
==
m
.
coords
[
1
]
+
i
and
piece
.
coords
[
0
]
==
m
.
coords
[
0
]
and
piece
.
orientation
==
'b'
:
winner
=
piece
bool
=
True
break
if
bool
==
True
and
winner
.
car
()
==
'R'
:
print
(
'partie finie, le vainqueur est le joueur 2'
)
if
bool
==
True
and
winner
.
car
()
==
'E'
:
print
(
'partie finie, le vainqueur est le joueur 1'
)
def
vainqueur_vect
(
self
):
mine_e
,
min_r
=
10
,
10
vect_e
,
vect_r
=
10
,
10
i
,
j
=
self
.
mont_sorti
.
coords
...
...
@@ -842,16 +911,20 @@ class Window(QMainWindow):
for
el
in
self
.
ele
:
print
(
el
.
orientation
,
dic_i
[
i
])
if
(
el
.
orientation
==
dic_i
[
i
])
or
(
el
.
orientation
==
dic_j
[
j
]):
print
(
'yyy'
)
vect_e
=
np
.
sqrt
((
el
.
coords
[
0
]
-
i
)
**
2
+
(
el
.
coords
[
1
]
-
j
)
**
2
)
if
mine
>
vect_e
:
mine
=
vect_e
print
(
vect_e
)
if
min_e
>
vect_e
:
min_e
=
vect_e
print
(
min_e
)
for
rh
in
self
.
rh
:
if
(
rh
.
orientation
==
dic_i
[
i
])
or
(
rh
.
orientation
==
dic_j
[
j
]):
vect_r
=
np
.
sqrt
((
rh
.
coords
[
0
]
-
i
)
**
2
+
(
rh
.
coords
[
1
]
-
j
)
**
2
)
if
minr
>
vect_r
:
minr
=
vect_r
print
(
mine
,
minr
)
if
minr
<
mine
:
if
min
_
r
>
vect_r
:
min
_
r
=
vect_r
print
(
min
_
e
,
min
_
r
)
if
min
_
r
<
min
_
e
:
print
(
"les rhinos gagnent!"
)
else
:
print
(
"les éléphants gagnent"
)
...
...
Write
Preview
Markdown
is supported
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