1
3 s=""
4 location = cube.find_cubie(10)
5 direction=cube.rotations[location]
6 dir=direction.get_column(1)
7 if not (location==(0,2,2) and int(dir[1])==1):
8 if location[1]==2:
9 if location==(0,2,0): s="Lul"
10 elif location==(2,2,0): s="ruR"
11 elif location==(2,2,2): s="Rur"
12 elif location==(0,2,2): s="RuL"
13 else:
14 if location==(0,0,0): s="u"
15 if location==(2,0,0): s="uu"
16 if location==(2,0,2): s="U"
17 if location==(0,0,2):
18 print "1. Placing (0,2,2) cubie"
19 if int(direction.get_column(0)[1])==-1: s="UFuf"
20 elif int(direction.get_column(1)[2])==-1: s="ulUL"
21 else: s="FufuuFUf"
22 return s
23
24 location = cube.find_cubie(28)
25 direction=cube.rotations[location]
26 dir=direction.get_column(1)
27 if not (location==(2,2,2) and int(dir[1])==1):
28 if location[1]==2:
29 if location==(0,2,0): s="Lul"
30 elif location==(2,2,0): s="ruR"
31 elif location==(2,2,2): s="Rur"
32 else:
33 if location==(0,0,0): s="uu"
34 if location==(2,0,0): s="U"
35 if location==(0,0,2): s="u"
36 if location==(2,0,2):
37 print "2. Placing (2,2,2) cubie"
38 if int(direction.get_column(1)[2])==-1: s="URur"
39 elif int(direction.get_column(1)[0])==-1: s="ufUF"
40 else: s="RuruuRUr"
41 return s
42
43 location = cube.find_cubie(26)
44 direction=cube.rotations[location]
45 dir=direction.get_column(1)
46 if not (location==(2,2,0) and int(dir[1])==1):
47 if location[1]==2:
48 if location==(0,2,0): s="Lul"
49 elif location==(2,2,0): s="ruR"
50 else:
51 if location==(0,0,0): s="U"
52 if location==(2,0,2): s="u"
53 if location==(0,0,2): s="uu"
54 if location==(2,0,0):
55 print "3. Placing (2,2,0) cubie"
56 if int(direction.get_column(1)[0])==-1: s="UBub"
57 elif int(direction.get_column(1)[2])==-1: s="urUR"
58 else: s="BubuuBUb"
59 return s
60 location = cube.find_cubie(8)
61 direction=cube.rotations[location]
62 dir=direction.get_column(1)
63 if not (location==(0,2,0) and int(dir[1])==1):
64 if location[1]==2:
65 if location==(0,2,0): s="Lul"
66 else:
67 if location==(2,0,0): s="u"
68 if location==(2,0,2): s="uu"
69 if location==(0,0,2): s="U"
70 if location==(0,0,0):
71 print "4. Placing (0,2,0) cubie"
72 if int(direction.get_column(2)[1])==-1: s="ULul"
73 elif int(direction.get_column(0)[1])==-1: s="ubUB"
74 else: s="LuluuLUl"
75 return s
76 location = cube.find_cubie(9)
77 direction=cube.rotations[location]
78 dir=direction.get_column(1)
79 if not (location==(0,2,1) and int(dir[1])==1):
80 if location[1]==2:
81 if location==(0,2,1): s="BfllbF"
82 if location==(1,2,2): s="rLffRl"
83 if location==(2,2,1): s="FbrrBf"
84 if location==(1,2,0): s="RlbbrL"
85 elif location[1]==1:
86 if location==(0,1,2):
87 if int(direction.get_column(1)[2])==-1: s="tbTuL"
88 else: s="TTRtUft"
89 if location==(2,1,2):
90 if int(direction.get_column(1)[2])==-1: s="lTuFt"
91 else: s="tBtUrTT"
92 if location==(2,1,0):
93 if int(direction.get_column(1)[2])==1: s="LtUbT"
94 else: s="TfTuRtt"
95 if location==(0,1,0):
96 if int(direction.get_column(2)[1])==-1: s="TFtul"
97 else: s="TTrTuBT"
98 else:
99 if location==(1,0,0): s="u"
100 if location==(2,0,1): s="uu"
101 if location==(1,0,2): s="U"
102 if location==(0,0,1):
103 print "5. Placing (0,2,1) cubie"
104 if int(direction.get_column(0)[1])==-1: s="uBfLbF"
105 else: s="BfllbF"
106 return s
107 location = cube.find_cubie(19)
108 direction=cube.rotations[location]
109 dir=direction.get_column(1)
110 if not (location==(1,2,2) and int(dir[1])==1):
111 if location[1]==2:
112 if location==(0,2,1): s="BfllbF"
113 if location==(1,2,2): s="rLffRl"
114 if location==(2,2,1): s="FbrrBf"
115 if location==(1,2,0): s="RlbbrL"
116 elif location[1]==1:
117 if location==(2,1,2):
118 if int(direction.get_column(1)[2])==-1: s="tlTuF"
119 else: s="TTBtUrt"
120 if location==(2,1,0):
121 if int(direction.get_column(1)[2])==-1: s="fTuRt"
122 else: s="tLtUbTT"
123 if location==(0,1,0):
124 if int(direction.get_column(1)[2])==1: s="FtUlT"
125 else: s="TrTubtt"
126 if location==(0,1,2):
127 if int(direction.get_column(2)[1])==-1: s="TRtuf"
128 else: s="TTbTuLT"
129 else:
130 if location==(0,0,1): s="u"
131 if location==(1,0,0): s="uu"
132 if location==(2,0,1): s="U"
133 if location==(1,0,2):
134 print "6. Placing (1,2,2) cubie"
135 if int(direction.get_column(1)[2])==-1: s="uLrFlR"
136 else: s="LrfflR"
137 return s
138 location = cube.find_cubie(27)
139 direction=cube.rotations[location]
140 dir=direction.get_column(1)
141 if not (location==(2,2,1) and int(dir[1])==1):
142 if location[1]==2:
143 if location==(0,2,1): s="BfllbF"
144 if location==(1,2,2): s="rLffRl"
145 if location==(2,2,1): s="FbrrBf"
146 if location==(1,2,0): s="RlbbrL"
147 elif location[1]==1:
148 if location==(2,1,0):
149 if int(direction.get_column(1)[2])==-1: s="tfTuR"
150 else: s="TTLtUbt"
151 if location==(0,1,0):
152 if int(direction.get_column(1)[2])==-1: s="rTuBt"
153 else: s="tFtUlTT"
154 if location==(0,1,2):
155 if int(direction.get_column(1)[2])==1: s="RtUfT"
156 else: s="TbTultt"
157 if location==(2,1,2):
158 if int(direction.get_column(2)[1])==-1: s="TBtur"
159 else: s="TTlTuFT"
160 else:
161 if location==(1,0,2): s="u"
162 if location==(0,0,1): s="uu"
163 if location==(1,0,0): s="U"
164 if location==(2,0,1):
165 print "7. Placing (2,2,1) cubie"
166 if int(direction.get_column(1)[0])==-1: s="uFbRfB"
167 else: s="FbrrfB"
168 return s
169 location = cube.find_cubie(17)
170 direction=cube.rotations[location]
171 dir=direction.get_column(1)
172 if not (location==(1,2,0) and int(dir[1])==1):
173 if location[1]==2:
174 if location==(0,2,1): s="BfllbF"
175 if location==(1,2,2): s="rLffRl"
176 if location==(2,2,1): s="FbrrBf"
177 if location==(1,2,0): s="RlbbrL"
178 elif location[1]==1:
179 if location==(0,1,0):
180 if int(direction.get_column(1)[2])==-1: s="trTuB"
181 else: s="TTFtUlt"
182 if location==(0,1,2):
183 if int(direction.get_column(1)[2])==-1: s="bTuLt"
184 else: s="tRtUfTT"
185 if location==(2,1,2):
186 if int(direction.get_column(1)[2])==1: s="BtUrT"
187 else: s="TlTuftt"
188 if location==(2,1,0):
189 if int(direction.get_column(2)[1])==-1: s="TLtub"
190 else: s="TTfTuRT"
191 else:
192 if location==(2,0,1): s="u"
193 if location==(1,0,2): s="uu"
194 if location==(0,0,1): s="U"
195 if location==(1,0,0):
196 print "8. Placing (1,2,0) cubie"
197 if int(direction.get_column(2)[1])==-1: s="uRlBrL"
198 else: s="RlbbrL"
199 return s
200 location = cube.find_cubie(5)
201 direction=cube.rotations[location]
202 dir=direction.get_column(1)
203 if not (location==(0,1,0) and int(dir[1])==1):
204 if location[1]==1:
205 if location==(0,1,0): s="bUBULul"
206 if location==(0,1,2): s="lULUFuf"
207 if location==(2,1,2): s="fUFURur"
208 if location==(2,1,0): s="rURUBub"
209 else:
210 if location==(1,0,0): s="uu"
211 if location==(0,0,1): s="u"
212 if location==(2,0,1): s="U"
213 if location==(1,0,2):
214 print "9. Placing (0,1,0) cubie"
215 if int(direction.get_column(0)[1])==-1: s="bUBULul"
216 else: s="uLulubUB"
217 return s
218 location = cube.find_cubie(7)
219 direction=cube.rotations[location]
220 dir=direction.get_column(1)
221 if not (location==(0,1,2) and int(dir[1])==1):
222 if location[1]==1:
223 if location==(0,1,0): s="bUBULul"
224 if location==(0,1,2): s="lULUFuf"
225 if location==(2,1,2): s="fUFURur"
226 if location==(2,1,0): s="rURUBub"
227 else:
228 if location==(0,0,1): s="uu"
229 if location==(1,0,2): s="u"
230 if location==(1,0,0): s="U"
231 if location==(2,0,1):
232 print "10. Placing (2,0,1) cubie"
233 if int(direction.get_column(0)[2])==1: s="lULUFuf"
234 else: s="uFufulUL"
235 return s
236 location = cube.find_cubie(25)
237 direction=cube.rotations[location]
238 dir=direction.get_column(1)
239 if not (location==(2,1,2) and int(dir[1])==1):
240 if location[1]==1:
241 if location==(0,1,0): s="bUBULul"
242 if location==(0,1,2): s="lULUFuf"
243 if location==(2,1,2): s="fUFURur"
244 if location==(2,1,0): s="rURUBub"
245 else:
246 if location==(1,0,2): s="uu"
247 if location==(2,0,1): s="u"
248 if location==(0,0,1): s="U"
249 if location==(1,0,0):
250 print "11. Placing (1,0,0) cubie"
251 if int(direction.get_column(1)[2])==-1: s="fUFURur"
252 else: s="uRurufUF"
253 return s
254 location = cube.find_cubie(23)
255 direction=cube.rotations[location]
256 dir=direction.get_column(1)
257 if not (location==(2,1,0) and int(dir[1])==1):
258 if location[1]==1:
259 if location==(0,1,0): s="bUBULul"
260 if location==(0,1,2): s="lULUFuf"
261 if location==(2,1,2): s="fUFURur"
262 if location==(2,1,0): s="rURUBub"
263 else:
264 if location==(2,0,1): s="uu"
265 if location==(1,0,0): s="u"
266 if location==(1,0,2): s="U"
267 if location==(0,0,1):
268 print "12. Placing (0,0,1) cubie"
269 if int(direction.get_column(1)[0])==-1: s="rURUBub"
270 else: s="uBuburUR"
271 return s
272 location = cube.find_cubie(2)
273 if not (location==(0,0,0)):
274 print "13. Placing (0,0,0) cubie"
275 if location==(0,0,2): s="U"
276 if location==(2,0,2): s="uu"
277 if location==(2,0,0): s="u"
278 return s
279 location = cube.find_cubie(4)
280 if not (location==(0,0,2)):
281 print "14. Placing (0,0,2) cubie"
282 if location==(2,0,2): s="uBUbruRBubu"
283 if location==(2,0,0): s="BUbruRBubUBUbruRBubu"
284 return s
285 location = cube.find_cubie(22)
286 if not (location==(2,0,2)):
287 print "15. Placing (2,0,2) cubie"
288 if location==(2,0,0): s="BUbruRBubuu"
289 return s
290 dir1=cube.rotations[0,0,0]
291 dir2=cube.rotations[0,0,2]
292 dir3=cube.rotations[2,0,2]
293 dir4=cube.rotations[2,0,0]
294 d1="0"
295 if int(dir1.get_column(1)[2])==1: d1="1"
296 if int(dir1.get_column(1)[0])==1: d1="2"
297 d2="0"
298 if int(dir2.get_column(1)[0])==1: d2="1"
299 if int(dir2.get_column(1)[2])==-1: d2="2"
300 d3="0"
301 if int(dir3.get_column(1)[2])==-1: d3="1"
302 if int(dir3.get_column(1)[0])==-1: d3="2"
303 d4="0"
304 if int(dir4.get_column(1)[0])==-1: d4="1"
305 if int(dir4.get_column(1)[2])==1: d4="2"
306 os=d1+d2+d3+d4
307 os+=os
308 if (os[0:4]=="0222" or os[0:2]=="21" or os[0:2]=="01"): s="FUfUFUUfUU"
309 if (os[1:5]=="0222" or os[1:3]=="21" or os[1:3]=="01"): s="RUrURUUrUU"
310 if (os[2:6]=="0222" or os[2:4]=="21" or os[2:4]=="01"): s="BUbUBUUbUU"
311 if (os[3:7]=="0222" or os[3:5]=="21" or os[3:5]=="01"): s="LUlULUUlUU"
312 if s != "": return s
313 loc1=cube.find_cubie(3)
314 loc2=cube.find_cubie(13)
315 loc3=cube.find_cubie(21)
316 loc4=cube.find_cubie(11)
317 if not (loc1==(0,0,1) and loc2==(1,0,2) and loc3==(2,0,1) and loc4==(1,0,0)):
318 if loc1==(0,0,1): s="fBLFbuufBLFb"
319 elif loc2==(1,0,2): s="rLFRluurLFRl"
320 elif loc1==(2,0,1): s="bFRBfuubFRBf"
321 else: s="lRBLruulRBLr"
322 return s
323 dir1=cube.rotations[0,0,1]
324 dir2=cube.rotations[1,0,2]
325 dir3=cube.rotations[2,0,1]
326 dir4=cube.rotations[1,0,0]
327 d1="0"; d2="0"; d3="0"; d4="0"
328 if int(dir1.get_column(1)[0])==1: d1="1"
329 if int(dir2.get_column(1)[2])==-1: d2="1"
330 if int(dir3.get_column(1)[0])==-1: d3="1"
331 if int(dir4.get_column(1)[2])==1: d4="1"
332 os=d1+d2+d3+d4
333 if os != "0000":
334 os += os
335 if os[0:4]=="0101": s="BtUrrttuuLuulttuurrTubuu"
336 if os[1:5]=="0101": s="LtUbbttuuFuufttuubbTuluu"
337 if os[2:6]=="0101": s="FtUllttuuRuurttuullTufuu"
338 if os[2:6]=="0101": s="RtUffttuuBuubttuuffTuruu"
339 if s!="": return s
340 if os[0:2]=="11": s="FRLtUbbttuuFuufttuubbTuluurf"
341 if os[1:3]=="11": s="RBFtUllttuuRuurttuullTufuubr"
342 if os[2:4]=="11": s="BLRtUffttuuBuubttuuffTuruulb"
343 if os[3:5]=="11": s="LFBtUrrttuuLuulttuurrTubuufl"
344 return s
345
346 print "Solution Found"
347 return ""
348