-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
52 lines (45 loc) · 1.47 KB
/
main.py
File metadata and controls
52 lines (45 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 4 19:50:28 2015
@author: Maxime
"""
from data import *
import renderer as r
from fenetre import Fenetre
from cubeCoord import Cube
from twoPhase import Solver
import traceback
from copy import copy
def test(cubeDisplay):
""" test de l'affichage 3D """
fenetre = Fenetre(1280, 720, fullscreen=False, maxfps=144)
fenetre.ajoutEvenementsRotation(cubeDisplay)
running = True
end = False
cubeSolver = copy(cubeDisplay)
while running:
try:
fenetre.prepare()
# Ce qu'on veut afficher :
r.render(cubeDisplay)
if not end: # Fonctions à n'executer qu'une fois
print("Mélange du cube...")
cubeDisplay.animation(fenetre, cubeSolver.melanger())
print()
s = Solver(cubeSolver)
print("Début phase 1 : {}".format(s.getPhase1Solution()))
cubeDisplay.animation(fenetre, s.getPhase1Solution())
print()
print("Début phase 2 : {}".format(s.getPhase2Solution()))
cubeDisplay.animation(fenetre, s.getPhase2Solution())
print()
print("{} mouvements.".format(len(s.getSolution())))
end = True
# Fin de ce qu'on veut afficher
fenetre.update()
except:
#traceback.print_exc()
running = False
fenetre.quitter()
return
test(Cube())