Skip to content

Commit

Permalink
Make main.py user-friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
Damodar Dahal committed May 24, 2017
1 parent 0cd52cc commit ec61df1
Showing 1 changed file with 15 additions and 55 deletions.
70 changes: 15 additions & 55 deletions main.py
Expand Up @@ -7,21 +7,29 @@
from time import sleep
import sys

print("HI");
print("Welcome to the Rubik's Cube!");

def fun():
"""This function is launched after the graphics has been initialized."""

print('Generating random algorithm')
algo=randomAlgorithm(20);
print(algo)

print('Applying random algorithm to the cube')
c.action(algo);

print('Getting the solution algorithm')
answer=c.solve()
#answer="y";
print ("Solved by: "+answer)

print (answer)

print('Applying the solution to the cube')
c.action(answer);
#c.actionRealTime(answer);
print (c.isSolved())
print ("HI")

print('Is rubiks cube solved? {}'.format(c.isSolved()))

print ("End of Program")

c=Cube()
#c.updateFaceColors();
graphics=GUI(c)
Expand All @@ -30,52 +38,4 @@ def fun():
c.setFunction(fun)


#algo=opposite_of("y2 R U R' y' R2 Ui E R U' R' U R' U Ei R2");
algo="S M z Si D xi Di L Fi R B2 M Ri M x Bi Li zi B yi Si y Ei yi L S Bi yi xi Ei R2 D xi Bi R xi xi zi M D2 zi yi Si F S Bi Di"
if False:
i=0
while True:
if(not c.isSolved()):
print("broken at first");
break;
i+=1
print ("see problems.txt");
print ("round "+str(i))
algo=randomAlgorithm(50)
print (algo)
c.action(algo);
try:
answer=c.solve();
except:
print ("error in program");
raise SystemError
c.action(answer)
if(not c.isSolved()):
print (FaceColor.top)
print (c.getSide(TOP_SIDE));
print ("");

print (FaceColor.bottom)
print ( c.getSide(BOTTOM_SIDE) );
print ("")

print (FaceColor.left);
print (c.getSide(LEFT_SIDE));
print ("");

print (FaceColor.right);
print (c.getSide(RIGHT_SIDE));
print ("");
print ("cube is not solved");
raise SystemError;
print ("\n")
sys.exit();
else:
#c.action(randomAlgorithm(50));
#c.actionRealTime(c.solve());
#c.save('saves/1');
#sys.exit();
pass


graphics.begin()

0 comments on commit ec61df1

Please sign in to comment.