final version

This commit is contained in:
Mat 2023-02-19 11:50:40 +01:00
parent 3b6c21f4b4
commit cc11b0d882

View File

@ -1,13 +1,8 @@
import os import os
import rotate_matrix
def turn_piece(piece): #based on a matrix MxN ie [(0,0),(0,0),(0,0)] m = 3 and n = 2 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) new_piece = rotate_matrix.clockwise(piece)
n_piece = len(piece[0]) return new_piece
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:
@ -56,7 +51,7 @@ while game:
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) #issue to assign the piece at number choose_piece = int(choose_piece)
except ValueError: except ValueError:
choose_piece =0 choose_piece =0
print('J\'ai besoin d\'un nombre') print('J\'ai besoin d\'un nombre')
@ -65,7 +60,12 @@ while game:
move_piece = input('Voulez vous tournez la pièce ? (o/n)\n') move_piece = input('Voulez vous tournez la pièce ? (o/n)\n')
if move_piece== 'o': if move_piece== 'o':
turn_piece(choose_piece) print('Voilà la pièce tourner')
piece_turn = turn_piece(piece_for_level[choose_level])
for i in piece_turn:
print(i)
else:
print('Où voulez vous mettre la pièce')
game=False game=False