Commit 0dfd8d9d authored by Guillaume CLOCHARD's avatar Guillaume CLOCHARD
Browse files

Update splitCubeImg()

Prend un cube et un mouvement à effectuer directement
parent a199621f
def splitCubeImg(cube,imgRot):
cubeSplit = cube.split("\n")
imgSplit = imgRot.split("\n")
sizeCube = len(cubeSplit)
sizeImg = len(imgSplit)
strImg = ""
i = 0
cptCube = 0
while i < sizeImg:
if i <=14 and i > 5:
if cptCube == 6 or cptCube == 7 or cptCube ==8:
spacesManquant = 10 * ' '
else:
spacesManquant = ''
strImg += cubeSplit[cptCube]
strImg += spacesManquant
strImg += imgSplit[i] + "\n"
cptCube += 1
else:
spacesManquant = 39 * ' '
strImg += spacesManquant
strImg += imgSplit[i] + "\n"
i += 1
return strImg
class AffichageMoves():
......@@ -427,3 +402,40 @@ class AffichageMoves():
imgStr += " \n"
imgStr += " \n"
return imgStr
Moves = AffichageMoves()
def splitCubeImg(c, mouv):
methodToCall = getattr(Moves, 'img_' + mouv)
imgRot = methodToCall()
cube = c.__str__()
cubeSplit = cube.split("\n")
imgSplit = imgRot.split("\n")
sizeCube = len(cubeSplit)
sizeImg = len(imgSplit)
strImg = ""
i = 0
cptCube = 0
while i < sizeImg:
if i <=14 and i > 5:
if cptCube == 6 or cptCube == 7 or cptCube ==8:
spacesManquant = 10 * ' '
else:
spacesManquant = ''
strImg += cubeSplit[cptCube]
strImg += spacesManquant
strImg += imgSplit[i] + "\n"
cptCube += 1
else:
spacesManquant = 39 * ' '
strImg += spacesManquant
strImg += imgSplit[i] + "\n"
i += 1
return strImg
from time import sleep
from utils import clear, readArgs, colorize, translate_mvt, newGetch, TermColors
from algo import algo_cfop
from images_ascii import AffichageMoves, splitCubeImg
from images_ascii import splitCubeImg
SPEED = 2 #écrans / sec
......@@ -28,8 +28,6 @@ def tuto(cube, mouvements):
print("Exécution de la manoeuvre : {}".format(resolution) )
print(cube)
a = AffichageMoves() #pour l'affichage des mouvements
for m in mouvements:
clear()
mouvementsRestants.remove(m)
......@@ -56,8 +54,8 @@ def tuto(cube, mouvements):
if 'moves' not in params:
print(cube)
else:
methodToCall = getattr(a,'img_' + m)
print(splitCubeImg(cube.__str__(),methodToCall()))
#L'utilisateur a demandé de voir l'aide des mouvements
print(splitCubeImg(cube, m))
print("Rotation : ", translate_mvt(m) +'\n\n')
mouvementsDone.append(m)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment