add turn piece
This commit is contained in:
parent
4608208b7f
commit
3b6c21f4b4
@ -1,4 +1,14 @@
|
|||||||
import os
|
import os
|
||||||
|
def turn_piece(piece): #based on a matrix MxN ie [(0,0),(0,0),(0,0)] m = 3 and n = 2
|
||||||
|
m_piece = len(piece)
|
||||||
|
n_piece = len(piece[0])
|
||||||
|
piece_turn = []
|
||||||
|
turn_m_piece = n_piece
|
||||||
|
turn_n_piece = m_piece
|
||||||
|
for i in range(turn_m_piece):
|
||||||
|
for j in range(turn_n_piece):
|
||||||
|
piece_turn.append(0)
|
||||||
|
|
||||||
game = True
|
game = True
|
||||||
while game:
|
while game:
|
||||||
print('Bienvenue dans le jeu cat puzzle')
|
print('Bienvenue dans le jeu cat puzzle')
|
||||||
@ -25,32 +35,39 @@ while game:
|
|||||||
|
|
||||||
|
|
||||||
print('Voilà les pièces que vous disposez pour complèter 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_for_level = {
|
||||||
piece_two = [(1,0),(1,0),(1,0)]
|
1:[(1,1),(1,0)],2:[(1,0),(1,0),(1,0)],3:[(1,1)]}
|
||||||
piece_three = [(1,1)]
|
|
||||||
|
|
||||||
print('Voilà la pièce 1:') #show the piece at the player
|
print('Voilà la pièce 1:') #show the piece at the player
|
||||||
for i in piece_one:
|
for i in piece_for_level[1]:
|
||||||
print(i)
|
print(i)
|
||||||
|
|
||||||
print('Voilà la pièce 2:')
|
print('Voilà la pièce 2:')
|
||||||
for i in piece_two:
|
for i in piece_for_level[2]:
|
||||||
print(i)
|
print(i)
|
||||||
|
|
||||||
print('Voilà la pièce 3:')
|
print('Voilà la pièce 3:')
|
||||||
for i in piece_three:
|
for i in piece_for_level[3]:
|
||||||
print(i)
|
print(i)
|
||||||
|
|
||||||
choose_piece = 0
|
choose_piece = 0
|
||||||
while choose_piece ==0:
|
while choose_piece ==0:
|
||||||
choose_piece = input('Choissisez la pièce 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:
|
try:
|
||||||
choose_piece = int(choose_piece)
|
choose_piece = int(choose_piece) #issue to assign the piece at number
|
||||||
except ValueError:
|
except ValueError:
|
||||||
choose_piece =0
|
choose_piece =0
|
||||||
print('J\'ai besoin d\'un nombre')
|
print('J\'ai besoin d\'un nombre')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
move_piece = input('Voulez vous tournez la pièce ? (o/n)\n')
|
||||||
|
if move_piece== 'o':
|
||||||
|
turn_piece(choose_piece)
|
||||||
|
|
||||||
|
|
||||||
game=False
|
game=False
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user