From 4608208b7f1843097efa1738b139f7d73b04f985 Mon Sep 17 00:00:00 2001 From: Mat Date: Mon, 13 Feb 2023 19:27:55 +0100 Subject: [PATCH] add choose level and correct spelling --- prototypes/cat_puzzle.py | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/prototypes/cat_puzzle.py b/prototypes/cat_puzzle.py index 42325b2..d63f308 100644 --- a/prototypes/cat_puzzle.py +++ b/prototypes/cat_puzzle.py @@ -3,34 +3,48 @@ game = True while game: print('Bienvenue dans le jeu cat puzzle') - print('Decouvrons ensemeble le premier niveau') #make a first level - level_one = [(1,1,1),(1,1,0),(1,1,1)] - print(level_one[0]) - print(level_one[1]) - print(level_one[2]) + choose_level = 0 + while choose_level == 0: + choose_level = input('Choissisez un niveau à résoudre\n') #choose a level of the game + try: + choose_level = int(choose_level) + except ValueError: + choose_level= 0 + print('Il me faut un nombre') + if choose_level!=1: + choose_level = 0 + print('Il n\'existe que le niveau 1 pour l\'instant') + + print('Découvrons ensemeble le niveau',choose_level) #make a first level + + if choose_level ==1: #select the level one and print it + level_one = [(1,1,1),(1,1,0),(1,1,1)] + print(level_one[0]) + print(level_one[1]) + print(level_one[2]) - print('Voila les piece que vous disposez pour completer le puzzle') #make piece for resolve the puzzle + print('Voilà les pièces que vous disposez pour complèter le puzzle') #make piece for resolve the puzzle nbr_piece = 3 piece_one = [(1,1),(1,0)] piece_two = [(1,0),(1,0),(1,0)] piece_three = [(1,1)] - print('Voila la piece 1:') #show the piece at the player + print('Voilà la pièce 1:') #show the piece at the player for i in piece_one: print(i) - print('Voila la piece 2:') + print('Voilà la pièce 2:') for i in piece_two: print(i) - print('Voila la piece 3:') + print('Voilà la pièce 3:') for i in piece_three: print(i) choose_piece = 0 while choose_piece ==0: - choose_piece = input('Choissisez la piece que vous voulez bouger ? ') #choice of the piece to move + choose_piece = input('Choissisez la pièce que vous voulez bouger ? ') #choice of the piece to move try: choose_piece = int(choose_piece) except ValueError: