Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
2048
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas Bianco
2048
Commits
b84ecf13
Commit
b84ecf13
authored
6 years ago
by
Garance Guey
Browse files
Options
Downloads
Patches
Plain Diff
bug fix
parent
33ea2835
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
game2048/grid_2048.py
+3
-10
3 additions, 10 deletions
game2048/grid_2048.py
with
3 additions
and
10 deletions
game2048/grid_2048.py
+
3
−
10
View file @
b84ecf13
...
@@ -188,12 +188,8 @@ def did_you_win (grid):
...
@@ -188,12 +188,8 @@ def did_you_win (grid):
#Fonctinnalité 6
#Fonctinnalité 6
<<<<<<<
HEAD
def
list_moove_possible
(
grid
):
#renvoie la liste des deplacements possibles
=======
def
list_move_possible
(
grid
):
def
list_move_possible
(
grid
):
>>>>>>>
c7f7a81e42fe1f954e38b492c9d251128aa9cf68
#renvoie la liste des deplacements possibles
list_bool
=
move_possible
(
grid
)
list_bool
=
move_possible
(
grid
)
list_final
=
[]
list_final
=
[]
if
list_bool
[
0
]:
if
list_bool
[
0
]:
...
@@ -216,27 +212,24 @@ def random_play():
...
@@ -216,27 +212,24 @@ def random_play():
#phase de jeu
#phase de jeu
while
not
is_game_over
(
grid_game
):
while
not
is_game_over
(
grid_game
):
<<<<<<<
HEAD
#pour chaque tour
#pour chaque tour
d
=
rd
.
choice
(
list_mo
o
ve_possible
(
grid_game
))
#on choisi un mouvement
d
=
rd
.
choice
(
list_move_possible
(
grid_game
))
#on choisi un mouvement
grid_game
=
move_grid
(
grid_game
,
d
)
#on le fait
grid_game
=
move_grid
(
grid_game
,
d
)
#on le fait
grid_game
=
grid_add_new_tile
(
grid_game
)
#une tuile se crée
grid_game
=
grid_add_new_tile
(
grid_game
)
#une tuile se crée
print
(
grid_to_string_with_size_and_theme
(
grid_game
,
THEMES
[
"
0
"
],
4
))
#on affuche le résulat
print
(
grid_to_string_with_size_and_theme
(
grid_game
,
THEMES
[
"
0
"
],
4
))
#on affuche le résulat
print
(
"
\n
***********************************
\n
"
)
#permet aux différentes grilles d'être plus lisible
print
(
"
\n
***********************************
\n
"
)
#permet aux différentes grilles d'être plus lisible
#vérification si le jeu est gagnant ou perdant
#vérification si le jeu est gagnant ou perdant
=======
d
=
rd
.
choice
(
list_move_possible
(
grid_game
))
d
=
rd
.
choice
(
list_move_possible
(
grid_game
))
grid_game
=
move_grid
(
grid_game
,
d
)
grid_game
=
move_grid
(
grid_game
,
d
)
grid_game
=
grid_add_new_tile
(
grid_game
)
grid_game
=
grid_add_new_tile
(
grid_game
)
print
(
grid_to_string_with_size_and_theme
(
grid_game
,
THEMES
[
"
0
"
],
4
))
print
(
grid_to_string_with_size_and_theme
(
grid_game
,
THEMES
[
"
0
"
],
4
))
print
(
"
\n
***********************************
\n
"
)
print
(
"
\n
***********************************
\n
"
)
>>>>>>>
c7f7a81e42fe1f954e38b492c9d251128aa9cf68
if
did_you_win
(
grid_game
):
if
did_you_win
(
grid_game
):
print
(
"
CONGRATS ! YOU WON !!!
"
)
print
(
"
CONGRATS ! YOU WON !!!
"
)
else
:
else
:
print
(
"
YOU FAIL, TRY AGAIN
"
)
print
(
"
YOU FAIL, TRY AGAIN
"
)
return
()
return
()
#TEST :
random_play()
random_play
()
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