Skip to content
Snippets Groups Projects
Commit b6f6814b authored by Boucas Marco's avatar Boucas Marco
Browse files

Ajout du fichier theme

parent a57227cf
No related merge requests found
# -*-coding:Latin-1 -*
def read_player_command():
move = input("Entrez votre commande (g (gauche), d (droite), h (haut), b (bas)):")
while len(move)!=1 and move not in "gdhb":
move = input("Entrée incorrecte \n Entrez votre commande (g (gauche), d (droite), h (haut), b (bas)):")
return move
def menu():
size=4
themeIndex=0
print('====Menu====')
print('1. Play')
print('2. Game size')
print('3. Game theme')
print('4. Exit')
answer=()
while len(answer)!=1 and answer in "1234":
answer('Incorrect Answer ! Do it again correctly this time')
if (answer=='1'):
#Launching the game
print('Launching the game')
elif (answer=='2'):
reponse=input('Size of the grid ?')
while type(eval(reponse))!='int' and int(reponse)>1:
reponse=input('Size of the grid ?')
size=int(reponse)
elif (answer=='3'):
print('====Game Theme===')
print('1. Classic theme')
print('2. Chemistry theme')
reponse=input('Theme of the game ?')
while type(eval(reponse))!='int' and reponse not in '12':
reponse=input('Theme of the game ?')
themeIndex=int(reponse)-1
elif (answer=='4'):
print('\nGoodbye')
\ No newline at end of file
from grid_2048 import *
from Pgrid_2048 import *
from pytest import *
......
from textual_2048 import *
from Ptextual_2048 import *
from pytest import *
import mock
def test_read_player_command(monkeypatch):
monkeypatch.setattr('builtins.input', lambda x: "g")
reponse = read_player_command()
assert reponse == "g"
\ No newline at end of file
THEMES = {"0": {"name": "Default", 0: "", 2: "2", 4: "4", 8: "8", 16: "16", 32: "32", 64: "64", 128: "128", 256: "256", 512: "512", 1024: "1024", 2048: "2048", 4096: "4096", 8192: "8192"}, "1": {"name": "Chemistry", 0: "", 2: "H", 4: "He", 8: "Li", 16: "Be", 32: "B", 64: "C", 128: "N", 256: "O", 512: "F", 1024: "Ne", 2048: "Na", 4096: "Mg", 8192: "Al"}, "2": {"name": "Alphabet", 0: "", 2: "A", 4: "B", 8: "C", 16: "D", 32: "E", 64: "F", 128: "G", 256: "H", 512: "I", 1024: "J", 2048: "K", 4096: "L", 8192: "M"}}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment