Skip to content
Snippets Groups Projects
Commit 33ea2835 authored by Garance Guey's avatar Garance Guey
Browse files

Merge branch 'master' of gitlab.viarezo.fr:2018biancot/2048

parents 645b85e0 ca1d2905
No related branches found
No related tags found
No related merge requests found
......@@ -87,32 +87,6 @@ def grid_to_string_with_size_and_theme(grid, theme,n):
def long_value_with_theme(grid,theme):
return max(len(theme[v]) for v in get_all_tiles(grid))
# FONCTIONNALITE 3
def read_player_command():
deplacements = {'g':"left",'d':"right",'h':"up",'b':"down"}
move = input("Entrez votre commande (g (gauche), d (droite), h (haut), b(bas)): ")
while move not in ['g','d','h','b']:
move = input("Commande invalide. \n Entrez votre commande (g (gauche), d (droite), h (haut), b(bas)): ")
return deplacements[move]
def read_size_grid():
size = input("Choisissez la taille de la grille : ")
while True:
try:
size = int(size)
except:
size = input("Taille invalide, choisissez un nombre entier. \n Choisissez la taille de la grille : ")
else:
break
return size
def read_theme_grid():
theme = input("Choisissez le numéro du thème : ")
while theme not in ['0','1','2']:
theme = input("Ce thème n'existe pas ! \n Choisissez le numéro du thème : ")
return THEMES[theme]
# FONCTIONNALITE 4
def del_zeros(row):
......
......@@ -66,10 +66,6 @@ def test_long_value_with_theme():
assert long_value_with_theme(grid,THEMES["1"]) == 2
assert long_value_with_theme(grid,THEMES["2"]) == 1
#FONCTIONNALITE 3
def test_read_player_command(monkeypatch):
monkeypatch.setattr('builtins.input', lambda x: "d")
# FONCTIONNALITE 4
......
#FONCTIONNALITE 3
def test_read_player_command(monkeypatch):
monkeypatch.setattr('builtins.input', lambda x: "d")
# FONCTIONNALITE 3
def read_player_command():
deplacements = {'g':"left",'d':"right",'h':"up",'b':"down"}
move = input("Entrez votre commande (g (gauche), d (droite), h (haut), b(bas)): ")
return move
while move not in ['g','d','h','b']:
move = input("Commande invalide. \n Entrez votre commande (g (gauche), d (droite), h (haut), b(bas)): ")
return deplacements[move]
def read_size_grid():
size = input("Choisissez la taille de la grille : ")
while True:
try:
size = int(size)
except:
size = input("Taille invalide, choisissez un nombre entier. \n Choisissez la taille de la grille : ")
else:
break
return size
def read_theme_grid():
theme = input("Choisissez le numéro du thème : ")
while theme not in ['0','1','2']:
theme = input("Ce thème n'existe pas ! \n Choisissez le numéro du thème : ")
return THEMES[theme]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment