示例#1
0
 def test_01_cross(self):
     for i in range(1000):
         cube = Cube()
         scramble = scramble_generator(20)
         cube.scramble(scramble)
         cross_solution, cross_cube = cross(cube)
         self.assertTrue(
             assert_cross_solved(cross_cube),
             msg="error on scramble: \"{0}\"\ncross: \"{1}\"".format(
                 scramble, cross_solution))
示例#2
0
 def test_09_cfop(self):
     for i in range(1000):
         cube = Cube()
         scramble = scramble_generator(20)
         cube.scramble(scramble)
         solution, new_cube = cfop(cube)
         cube.scramble(solution)
         self.assertTrue(
             cube.is_solved(),
             msg="error on scramble: \"{0}\"\nsolution: \"{1}".format(
                 scramble, solution))
示例#3
0
 def test_02_first_pair(self):
     for i in range(1000):
         cube = Cube()
         scramble = scramble_generator(20)
         cube.scramble(scramble)
         cross_solution, cross_cube = cross(cube)
         first_pair_solution, fstp_cube = first_pair(cross_cube)
         self.assertTrue(
             assert_first_pair(fstp_cube),
             msg="error on scramble: \"{0}\"\ncross: \"{1}\"\nfirst pair: "
             "\"{2}\"".format(scramble, cross_solution,
                              first_pair_solution))
示例#4
0
 def test_07_oll(self):
     for i in range(1000):
         cube = Cube()
         scramble = scramble_generator(20)
         cube.scramble(scramble)
         cross_solution, cross_cube = cross(cube)
         f2l_solution, f2l_cube = f2l(cross_cube)
         oll_solution, oll_cube = oll(f2l_cube)
         self.assertTrue(
             assert_oll(oll_cube),
             msg=
             "error on scramble: \"{0}\"\ncross: \"{1}\"\nf2l: \"{2}\"\noll: \"{3}\""
             .format(scramble, cross_solution, f2l_solution, oll_solution))
示例#5
0
 def test_04_third_pair(self):
     for i in range(1000):
         cube = Cube()
         scramble = scramble_generator(20)
         cube.scramble(scramble)
         cross_solution, cross_cube = cross(cube)
         first_pair_solution, fstp_cube = first_pair(cross_cube)
         second_pair_solution, sndp_cube = second_pair(fstp_cube)
         third_pair_solution, trdp_cube = third_pair(sndp_cube)
         self.assertTrue(
             assert_third_pair(trdp_cube),
             msg="error on scramble: \"{0}\"\ncross: \"{1}\"\nfirst pair: "
             "\"{2}\"\nsecond pair: \"{3}\"\nthird pair: \"{4}\"".format(
                 scramble, cross_solution, first_pair_solution,
                 second_pair_solution, third_pair_solution))
示例#6
0
from rubiks_cube import rubiks_cube
from utils import scramble_generator


# Create new cube object
cube = rubiks_cube.Cube()
# Prints the state of the cube
cube.print()
# Example of scramble generation
scramble = scramble_generator(18)
print(scramble)
# Example of scramble
cube.scramble("R B R2 F U' L2 D L' U2 R' D' F2 L F' D2 B2 U B'")
cube.print()