Changeset 7705:e2e7adbd831b
- Timestamp:
- 11/28/07 12:01:57 (5 years ago)
- Branch:
- default
- File:
-
- 1 edited
-
sage/groups/perm_gps/cubegroup.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/groups/perm_gps/cubegroup.py
r7704 r7705 45 45 - DJ (2007-09): rewrote docstring for CubeGroup's "solve". 46 46 - Robert Bradshaw (2007-09): Versatile parse function for all input types. 47 - Robert Bradshaw (2007-11): Cleanup. 47 48 48 49 REFERENCES: … … 91 92 ####################### predefined colors ################## 92 93 93 red = (1,0,0) ## F face 94 green = (0,1,0) ## R face 95 blue = (0,0,1) ## D face 96 yellow = (1,1,0) ## L face 97 white = (1,1,1) ## none 98 orange = (1,0.6,0.3) ## B face 99 purple = (1,0,1) ## none 100 lpurple = (1,0.63,1) ## U face 101 lightblue = (0,1,1) ## none 102 lgrey = (0.75,0.75,0.75) ## sagemath.org color 94 named_colors = { 95 'red': (1,0,0), ## F face 96 'green': (0,1,0), ## R face 97 'blue': (0,0,1), ## D face 98 'yellow': (1,1,0), ## L face 99 'white': (1,1,1), ## none 100 'orange': (1,0.6,0.3), ## B face 101 'purple': (1,0,1), ## none 102 'lpurple': (1,0.63,1), ## U face 103 'lightblue': (0,1,1), ## none 104 'lgrey': (0.75,0.75,0.75), ## sagemath.org color 105 } 106 globals().update(named_colors) 103 107 104 108 ######################################################### … … 151 155 """ 152 156 return [lst.index(i)+1 for i in range(1,1+len(lst))] 153 157 158 face_polys = { 154 159 ### bottom layer L, F, R, B 155 156 def ldb(rgbclr): 157 #square labeled 14 158 return polygon([[-3,0],[-2,0], [-2,1], [-3,1]], rgbcolor=rgbclr) 159 160 def ld(rgbclr): 161 #square labeled 15 162 return polygon([[-2,0],[-1,0], [-1,1], [-2,1]], rgbcolor=rgbclr) 163 164 def lfd(rgbclr): 165 #square labeled 16 166 return polygon([[-1,0],[0,0], [0,1], [-1,1]], rgbcolor=rgbclr) 167 168 def fdl(rgbclr): 169 #square labeled 22 170 return polygon([[0,0],[1,0], [1,1], [0,1]], rgbcolor=rgbclr) 171 172 def fd(rgbclr): 173 #square labeled 23 174 return polygon([[1,0],[2,0], [2,1], [1,1]], rgbcolor=rgbclr) 175 176 def frd(rgbclr): 177 #square labeled 24 178 return polygon([[2,0],[3,0], [3,1], [2,1]], rgbcolor=rgbclr) 179 180 def rdf(rgbclr): 181 #square labeled 30 182 return polygon([[3,0],[4,0], [4,1], [3,1]], rgbcolor=rgbclr) 183 184 def rd(rgbclr): 185 #square labeled 31 186 return polygon([[4,0],[5,0], [5,1], [4,1]], rgbcolor=rgbclr) 187 188 def rbd(rgbclr): 189 #square labeled 32 190 return polygon([[5,0],[6,0], [6,1], [5,1]], rgbcolor=rgbclr) 191 192 def bdr(rgbclr): 193 #square labeled 38 194 return polygon([[6,0],[7,0], [7,1], [6,1]], rgbcolor=rgbclr) 195 196 def bd(rgbclr): 197 #square labeled 39 198 return polygon([[7,0],[8,0], [8,1], [7,1]], rgbcolor=rgbclr) 199 200 def bld(rgbclr): 201 #square labeled 40 202 return polygon([[8,0],[9,0], [9,1], [8,1]], rgbcolor=rgbclr) 203 160 'ldb': [[-3,0],[-2,0], [-2,1], [-3,1]], #square labeled 14 161 'ld': [[-2,0],[-1,0], [-1,1], [-2,1]], #square labeled 15 162 'lfd': [[-1,0],[0,0], [0,1], [-1,1]], #square labeled 16 163 'fdl': [[0,0],[1,0], [1,1], [0,1]], #square labeled 22 164 'fd': [[1,0],[2,0], [2,1], [1,1]], #square labeled 23 165 'frd': [[2,0],[3,0], [3,1], [2,1]], #square labeled 24 166 'rdf': [[3,0],[4,0], [4,1], [3,1]], #square labeled 30 167 'rd': [[4,0],[5,0], [5,1], [4,1]], #square labeled 31 168 'rbd': [[5,0],[6,0], [6,1], [5,1]], #square labeled 32 169 'bdr': [[6,0],[7,0], [7,1], [6,1]], #square labeled 38 170 'bd': [[7,0],[8,0], [8,1], [7,1]], #square labeled 39 171 'bld': [[8,0],[9,0], [9,1], [8,1]], #square labeled 40 204 172 ### middle layer L,F,R, B 205 206 def lb(rgbclr): 207 #square labeled 12 208 return polygon([[-3,1],[-2,1], [-2,2], [-3,2]], rgbcolor=rgbclr) 209 210 def l_center(rgbclr): 211 return polygon([[-2,1],[-1,1], [-1,2], [-2,2]], rgbcolor=rgbclr) 212 213 def lf(rgbclr): 214 #square labeled 13 215 return polygon([[-1,1],[0,1], [0,2], [-1,2]], rgbcolor=rgbclr) 216 217 def fl(rgbclr): 218 #square labeled 20 219 return polygon([[0,1],[1,1], [1,2], [0,2]], rgbcolor=rgbclr) 220 221 def f_center(rgbclr): 222 return polygon([[1,1],[2,1], [2,2], [1,2]], rgbcolor=rgbclr) 223 224 def fr(rgbclr): 225 #square labeled 21 226 return polygon([[2,1],[3,1], [3,2], [2,2]], rgbcolor=rgbclr) 227 228 def rf(rgbclr): 229 #square labeled 28 230 return polygon([[3,1],[4,1], [4,2], [3,2]], rgbcolor=rgbclr) 231 232 def r_center(rgbclr): 233 return polygon([[4,1],[5,1], [5,2], [4,2]], rgbcolor=rgbclr) 234 235 def rb(rgbclr): 236 #square labeled 29 237 return polygon([[5,1],[6,1], [6,2], [5,2]], rgbcolor=rgbclr) 238 239 def br(rgbclr): 240 #square labeled 36 241 return polygon([[6,1],[7,1], [7,2], [6,2]], rgbcolor=rgbclr) 242 243 def b_center(rgbclr): 244 return polygon([[7,1],[8,1], [8,2], [7,2]], rgbcolor=rgbclr) 245 246 def bl(rgbclr): 247 #square labeled 37 248 return polygon([[8,1],[9,1], [9,2], [8,2]], rgbcolor=rgbclr) 249 173 'lb': [[-3,1],[-2,1], [-2,2], [-3,2]], #square labeled 12 174 'l_center': [[-2,1],[-1,1], [-1,2], [-2,2]], #center square 175 'lf': [[-1,1],[0,1], [0,2], [-1,2]], #square labeled 13 176 'fl': [[0,1],[1,1], [1,2], [0,2]], #square labeled 20 177 'f_center': [[1,1],[2,1], [2,2], [1,2]], #center square 178 'fr': [[2,1],[3,1], [3,2], [2,2]], #square labeled 21 179 'rf': [[3,1],[4,1], [4,2], [3,2]], #square labeled 28 180 'r_center': [[4,1],[5,1], [5,2], [4,2]], #center square 181 'rb': [[5,1],[6,1], [6,2], [5,2]], #square labeled 29 182 'br': [[6,1],[7,1], [7,2], [6,2]], #square labeled 36 183 'b_center': [[7,1],[8,1], [8,2], [7,2]], #center square 184 'bl': [[8,1],[9,1], [9,2], [8,2]], #square labeled 37 250 185 ## top layer L, F, R, B 251 252 def lbu(rgbclr): 253 #square labeled 9 254 return polygon([[-3,2],[-2,2], [-2,3], [-3,3]], rgbcolor=rgbclr) 255 256 def lu(rgbclr): 257 #square labeled 10 258 return polygon([[-2,2],[-1,2], [-1,3], [-2,3]], rgbcolor=rgbclr) 259 260 def luf(rgbclr): 261 #square labeled 11 262 return polygon([[-1,2],[0,2], [0,3], [-1,3]], rgbcolor=rgbclr) 263 264 def flu(rgbclr): 265 #square labeled 17 266 return polygon([[0,2],[1,2], [1,3], [0,3]], rgbcolor=rgbclr) 267 268 def fu(rgbclr): 269 #square labeled 18 270 return polygon([[1,2],[2,2], [2,3], [1,3]], rgbcolor=rgbclr) 271 272 def fur(rgbclr): 273 #square labeled 19 274 return polygon([[2,2],[3,2], [3,3], [2,3]], rgbcolor=rgbclr) 275 276 def ruf(rgbclr): 277 #square labeled 25 278 return polygon([[3,2],[4,2], [4,3], [3,3]], rgbcolor=rgbclr) 279 280 def ru(rgbclr): 281 #square labeled 26 282 return polygon([[4,2],[5,2], [5,3], [4,3]], rgbcolor=rgbclr) 283 284 def rub(rgbclr): 285 #square labeled 27 286 return polygon([[5,2],[6,2], [6,3], [5,3]], rgbcolor=rgbclr) 287 288 def bur(rgbclr): 289 #square labeled 33 290 return polygon([[6,2],[7,2], [7,3], [6,3]], rgbcolor=rgbclr) 291 292 def bu(rgbclr): 293 #square labeled 34 294 return polygon([[7,2],[8,2], [8,3], [7,3]], rgbcolor=rgbclr) 295 296 def bul(rgbclr): 297 #square labeled 35 298 return polygon([[8,2],[9,2], [9,3], [8,3]], rgbcolor=rgbclr) 299 186 'lbu': [[-3,2],[-2,2], [-2,3], [-3,3]], #square labeled 9 187 'lu': [[-2,2],[-1,2], [-1,3], [-2,3]], #square labeled 10 188 'luf': [[-1,2],[0,2], [0,3], [-1,3]], #square labeled 11 189 'flu': [[0,2],[1,2], [1,3], [0,3]], #square labeled 17 190 'fu': [[1,2],[2,2], [2,3], [1,3]], #square labeled 18 191 'fur': [[2,2],[3,2], [3,3], [2,3]], #square labeled 19 192 'ruf': [[3,2],[4,2], [4,3], [3,3]], #square labeled 25 193 'ru': [[4,2],[5,2], [5,3], [4,3]], #square labeled 26 194 'rub': [[5,2],[6,2], [6,3], [5,3]], #square labeled 27 195 'bur': [[6,2],[7,2], [7,3], [6,3]], #square labeled 33 196 'bu': [[7,2],[8,2], [8,3], [7,3]], #square labeled 34 197 'bul': [[8,2],[9,2], [9,3], [8,3]], #square labeled 35 300 198 # down face 301 302 def dlf(rgbclr): 303 #square labeled 41 304 return polygon([[0,-1],[1,-1], [1,0], [0,0]], rgbcolor=rgbclr) 305 306 def df(rgbclr): 307 #square labeled 42 308 return polygon([[1,-1],[2,-1], [2,0], [1,0]], rgbcolor=rgbclr) 309 310 def dfr(rgbclr): 311 #square labeled 43 312 return polygon([[2,-1],[3,-1], [3,0], [2,0]], rgbcolor=rgbclr) 313 314 def dl(rgbclr): 315 #square labeled 44 316 return polygon([[0,-2],[1,-2], [1,-1], [0,-1]], rgbcolor=rgbclr) 317 318 def d_center(rgbclr): 319 return polygon([[1,-2],[2,-2], [2,-1], [1,-1]], rgbcolor=rgbclr) 320 321 def dr(rgbclr): 322 #square labeled 45 323 return polygon([[2,-2],[3,-2], [3,-1], [2,-1]], rgbcolor=rgbclr) 324 325 def dlb(rgbclr): 326 #square labeled 46 327 return polygon([[0,-3],[1,-3], [1,-2], [0,-2]], rgbcolor=rgbclr) 328 329 def db(rgbclr): 330 #square labeled 47 331 return polygon([[1,-3],[2,-3], [2,-2], [1,-2]], rgbcolor=rgbclr) 332 333 def drb(rgbclr): 334 #square labeled 48 335 return polygon([[2,-3],[3,-3], [3,-2], [2,-2]], rgbcolor=rgbclr) 336 199 'dlf': [[0,-1],[1,-1], [1,0], [0,0]], #square labeled 41 200 'df': [[1,-1],[2,-1], [2,0], [1,0]], #square labeled 42 201 'dfr': [[2,-1],[3,-1], [3,0], [2,0]], #square labeled 43 202 'dl': [[0,-2],[1,-2], [1,-1], [0,-1]], #square labeled 44 203 'd_center': [[1,-2],[2,-2], [2,-1], [1,-1]], #center square 204 'dr': [[2,-2],[3,-2], [3,-1], [2,-1]], #square labeled 45 205 'dlb': [[0,-3],[1,-3], [1,-2], [0,-2]], #square labeled 46 206 'db': [[1,-3],[2,-3], [2,-2], [1,-2]], #square labeled 47 207 'drb': [[2,-3],[3,-3], [3,-2], [2,-2]], #square labeled 48 337 208 # up face 338 339 def ufl(rgbclr): 340 #square labeled 6 341 return polygon([[0,3],[1,3], [1,4], [0,4]], rgbcolor=rgbclr) 342 343 def uf(rgbclr): 344 #square labeled 7 345 return polygon([[1,3],[2,3], [2,4], [1,4]], rgbcolor=rgbclr) 346 347 def urf(rgbclr): 348 #square labeled 8 349 return polygon([[2,3],[3,3], [3,4], [2,4]], rgbcolor=rgbclr) 350 351 def ul(rgbclr): 352 #square labeled 4 353 return polygon([[0,4],[1,4], [1,5], [0,5]], rgbcolor=rgbclr) 354 355 def u_center(rgbclr): 356 return polygon([[1,4],[2,4], [2,5], [1,5]], rgbcolor=rgbclr) 357 358 def ur(rgbclr): 359 #square labeled 5 360 return polygon([[2,4],[3,4], [3,5], [2,5]], rgbcolor=rgbclr) 361 362 def ulb(rgbclr): 363 #square labeled 1 364 return polygon([[0,6],[1,6], [1,5], [0,5]], rgbcolor=rgbclr) 365 366 def ub(rgbclr): 367 #square labeled 2 368 return polygon([[1,6],[2,6], [2,5], [1,5]], rgbcolor=rgbclr) 369 370 def ubr(rgbclr): 371 #square labeled 3 372 return polygon([[2,6],[3,6], [3,5], [2,5]], rgbcolor=rgbclr) 209 'ufl': [[0,3],[1,3], [1,4], [0,4]], #square labeled 6 210 'uf': [[1,3],[2,3], [2,4], [1,4]], #square labeled 7 211 'urf': [[2,3],[3,3], [3,4], [2,4]], #square labeled 8 212 'ul': [[0,4],[1,4], [1,5], [0,5]], #square labeled 4 213 'u_center': [[1,4],[2,4], [2,5], [1,5]], #center square 214 'ur': [[2,4],[3,4], [3,5], [2,5]], #square labeled 5 215 'ulb': [[0,6],[1,6], [1,5], [0,5]], #square labeled 1 216 'ub': [[1,6],[2,6], [2,5], [1,5]], #square labeled 2 217 'ubr': [[2,6],[3,6], [3,5], [2,5]], #square labeled 3 218 } 219 220 def create_poly(face, color): 221 return polygon(face_polys[face], rgbcolor=color) 373 222 374 223 #################################################### 224 225 singmaster_indices = { 226 1: "ulb", 227 2: "ub", 228 3: "ubr", 229 4: "ul", 230 5: "ur", 231 6: "ufl", 232 7: "uf", 233 8: "urf", 234 14: "ldb", 235 15: "ld", 236 16: "lfd", 237 12: "lb", 238 13: "lf", 239 9: "lbu", 240 10: "lu", 241 11: "luf", 242 17: "flu", 243 18: "fu", 244 19: "fur", 245 20: "fl", 246 21: "fr", 247 22: "fdl", 248 23: "fd", 249 24: "frd", 250 41: "dlf", 251 42: "df", 252 43: "dfr", 253 44: "dl", 254 45: "dr", 255 46: "dlb", 256 47: "db", 257 48: "drb", 258 33: "bur", 259 34: "bu", 260 35: "bul", 261 36: "br", 262 37: "bl", 263 38: "bdr", 264 39: "bd", 265 40: "bld", 266 25: "ruf", 267 26: "ru", 268 27: "rub", 269 28: "rf", 270 29: "rb", 271 30: "rdf", 272 31: "rd", 273 32: "rbd", 274 } 375 275 376 276 def index2singmaster(facet): … … 383 283 'dlf' 384 284 """ 385 if facet==1: return "ulb" 386 if facet==2: return "ub" 387 if facet==3: return "ubr" 388 if facet==4: return "ul" 389 if facet==5: return "ur" 390 if facet==6: return "ufl" 391 if facet==7: return "uf" 392 if facet==8: return "urf" 393 if facet==14: return "ldb" 394 if facet==15: return "ld" 395 if facet==16: return "lfd" 396 if facet==12: return "lb" 397 if facet==13: return "lf" 398 if facet==9: return "lbu" 399 if facet==10: return "lu" 400 if facet==11: return "luf" 401 if facet==17: return "flu" 402 if facet==18: return "fu" 403 if facet==19: return "fur" 404 if facet==20: return "fl" 405 if facet==21: return "fr" 406 if facet==22: return "fdl" 407 if facet==23: return "fd" 408 if facet==24: return "frd" 409 if facet==41: return "dlf" 410 if facet==42: return "df" 411 if facet==43: return "dfr" 412 if facet==44: return "dl" 413 if facet==45: return "dr" 414 if facet==46: return "dlb" 415 if facet==47: return "db" 416 if facet==48: return "drb" 417 if facet==33: return "bur" 418 if facet==34: return "bu" 419 if facet==35: return "bul" 420 if facet==36: return "br" 421 if facet==37: return "bl" 422 if facet==38: return "bdr" 423 if facet==39: return "bd" 424 if facet==40: return "bld" 425 if facet==25: return "ruf" 426 if facet==26: return "ru" 427 if facet==27: return "rub" 428 if facet==28: return "rf" 429 if facet==29: return "rb" 430 if facet==30: return "rdf" 431 if facet==31: return "rd" 432 if facet==32: return "rbd" 433 434 def color_of_square(facet): 285 return singmaster_indices[facet] 286 287 def color_of_square(facet, colors=['lpurple', 'yellow', 'red', 'green', 'orange', 'blue']): 435 288 """ 436 289 Returns the color the facet has in the solved state. … … 441 294 'blue' 442 295 """ 443 if facet== 1: return "lpurple" 444 if facet== 2: return "lpurple" 445 if facet== 3: return "lpurple" 446 if facet== 4: return "lpurple" 447 if facet== 5: return "lpurple" 448 if facet== 6: return "lpurple" 449 if facet== 7: return "lpurple" 450 if facet== 8: return "lpurple" 451 if facet== 9: return "yellow" 452 if facet==10: return "yellow" 453 if facet==11: return "yellow" 454 if facet==12: return "yellow" 455 if facet==13: return "yellow" 456 if facet==14: return "yellow" 457 if facet==15: return "yellow" 458 if facet==16: return "yellow" 459 if facet==41: return "blue" 460 if facet==42: return "blue" 461 if facet==43: return "blue" 462 if facet==44: return "blue" 463 if facet==45: return "blue" 464 if facet==46: return "blue" 465 if facet==47: return "blue" 466 if facet==48: return "blue" 467 if facet==33: return "orange" 468 if facet==34: return "orange" 469 if facet==35: return "orange" 470 if facet==36: return "orange" 471 if facet==37: return "orange" 472 if facet==38: return "orange" 473 if facet==39: return "orange" 474 if facet==40: return "orange" 475 if facet==25: return "green" 476 if facet==26: return "green" 477 if facet==27: return "green" 478 if facet==28: return "green" 479 if facet==29: return "green" 480 if facet==30: return "green" 481 if facet==31: return "green" 482 if facet==32: return "green" 483 if facet==17: return "red" 484 if facet==18: return "red" 485 if facet==19: return "red" 486 if facet==20: return "red" 487 if facet==21: return "red" 488 if facet==22: return "red" 489 if facet==23: return "red" 490 if facet==24: return "red" 296 return colors[(facet-1) // 8] 491 297 298 cubie_center_list = { 299 # centers of the cubies on the F,U, R faces 300 1: [1/2,1/2,5/2], # ulb 301 2: [1/2,3/2,5/2], # ub 302 3: [1/2,5/2,5/2], # ubr 303 4: [3/2,1/2,5/2], # ul 304 5: [3/2,5/2,5/2], # ur 305 6: [5/2,1/2,5/2], # ufl 306 7: [5/2,3/2,5/2], # uf 307 8: [5/2,5/2,5/2], # urf 308 17: [5/2,1/2,5/2], # flu 309 18: [5/2,3/2,5/2], # fu 310 19: [5/2,5/2,5/2], # fur 311 20: [5/2,1/2,3/2], # fl 312 21: [5/2,5/2,3/2], # fr 313 22: [5/2,1/2,1/2], # fdl 314 23: [5/2,3/2,1/2], # fd 315 24: [5/2,5/2,1/2], # frd 316 25: [5/2,5/2,5/2], # rfu 317 26: [3/2,5/2,5/2], # ru 318 27: [1/2,5/2,5/2], # rub 319 28: [5/2,5/2,3/2], # rf 320 29: [1/2,5/2,3/2], # rb 321 30: [5/2,5/2,1/2], # rdf 322 31: [3/2,5/2,1/2], # rd 323 32: [1/2,5/2,1/2], # rbd 324 } 325 492 326 def cubie_centers(label): 493 # centers of the cubies on the F,U, R faces 494 if label == 1: return [1/2,1/2,5/2] #ulb, 495 if label == 2: return [1/2,3/2,5/2] # ub, 496 if label == 3: return [1/2,5/2,5/2] # ubr, 497 if label == 4: return [3/2,1/2,5/2] # ul, 498 if label == 5: return [3/2,5/2,5/2] # ur, 499 if label == 6: return [5/2,1/2,5/2] # ufl, 500 if label == 7: return [5/2,3/2,5/2] # uf, 501 if label == 8: return [5/2,5/2,5/2] # urf 502 if label == 17: return [5/2,1/2,5/2] # flu 503 if label == 18: return [5/2,3/2,5/2] # fu 504 if label == 19: return [5/2,5/2,5/2] # fur 505 if label == 20: return [5/2,1/2,3/2] # fl 506 if label == 21: return [5/2,5/2,3/2] # fr 507 if label == 22: return [5/2,1/2,1/2] # fdl 508 if label == 23: return [5/2,3/2,1/2] # fd 509 if label == 24: return [5/2,5/2,1/2] # frd 510 if label == 25: return [5/2,5/2,5/2] #rfu, 511 if label == 26: return [3/2,5/2,5/2] # ru, 512 if label == 27: return [1/2,5/2,5/2] # rub 513 if label == 28: return [5/2,5/2,3/2] # rf, 514 if label == 29: return [1/2,5/2,3/2] # rb, 515 if label == 30: return [5/2,5/2,1/2] # rdf 516 if label == 31: return [3/2,5/2,1/2] # rd, 517 if label == 32: return [1/2,5/2,1/2] #rbd, 327 return cubie_center_list[label] 518 328 519 329 def cubie_colors(label,state0): 520 330 # colors of the cubies on the F,U, R faces 521 clr_any = white331 clr_any = named_colors['white'] 522 332 state = inv_list(state0) 523 if label == 1: return [clr_any, eval(color_of_square(state[1-1])), clr_any] #ulb,524 if label == 2: return [clr_any, eval(color_of_square(state[2-1])),clr_any] # ub,525 if label == 3: return [clr_any, eval(color_of_square(state[3-1])), eval(color_of_square(state[27-1]))] # ubr,526 if label == 4: return [clr_any, eval(color_of_square(state[4-1])), clr_any] # ul,527 if label == 5: return [clr_any, eval(color_of_square(state[5-1])), eval(color_of_square(state[26-1]))] # ur,528 if label == 6: return [eval(color_of_square(state[17-1])), eval(color_of_square(state[6-1])), clr_any] # ufl,529 if label == 7: return [eval(color_of_square(state[18-1])), eval(color_of_square(state[7-1])), clr_any] # uf,530 if label == 8: return [eval(color_of_square(state[19-1])), eval(color_of_square(state[8-1])), eval(color_of_square(state[25-1]))] # urf,531 if label == 17: return [ eval(color_of_square(state[17-1])), eval(color_of_square(state[6-1])), clr_any] # flu532 if label == 18: return [ eval(color_of_square(state[18-1])), eval(color_of_square(state[7-1])), clr_any] # fu533 if label == 19: return [ eval(color_of_square(state[19-1])), eval(color_of_square(state[8-1])), eval(color_of_square(state[25-1]))] # fur534 if label == 20: return [ eval(color_of_square(state[20-1])), clr_any, clr_any] # fl535 if label == 21: return [ eval(color_of_square(state[21-1])), clr_any, eval(color_of_square(state[28-1]))] # fr536 if label == 22: return [ eval(color_of_square(state[22-1])), clr_any, clr_any] # fdl537 if label == 23: return [ eval(color_of_square(state[23-1])), clr_any, clr_any] # fd538 if label == 24: return [ eval(color_of_square(state[24-1])), clr_any, eval(color_of_square(state[30-1]))] # frd539 if label == 25: return [ eval(color_of_square(state[19-1])),eval(color_of_square(state[8-1])),eval(color_of_square(state[25-1]))] #rfu,540 if label == 26: return [clr_any, eval(color_of_square(state[5-1])),eval(color_of_square(state[26-1]))] # ru,541 if label == 27: return [clr_any, eval(color_of_square(state[3-1])),eval(color_of_square(state[27-1]))] # rub,542 if label == 28: return [ eval(color_of_square(state[21-1])),clr_any,eval(color_of_square(state[28-1]))] # rf,543 if label == 29: return [clr_any,clr_any, eval(color_of_square(state[29-1]))] # rb,544 if label == 30: return [ eval(color_of_square(state[24-1])),clr_any,eval(color_of_square(state[30-1]))] # rdf,545 if label == 31: return [clr_any,clr_any, eval(color_of_square(state[31-1]))] # rd,546 if label == 32: return [clr_any,clr_any, eval(color_of_square(state[32-1]))] #rbd,333 if label == 1: return [clr_any, named_colors[color_of_square(state[1-1])], clr_any] #ulb, 334 if label == 2: return [clr_any,named_colors[color_of_square(state[2-1])],clr_any] # ub, 335 if label == 3: return [clr_any, named_colors[color_of_square(state[3-1])], named_colors[color_of_square(state[27-1])]] # ubr, 336 if label == 4: return [clr_any, named_colors[color_of_square(state[4-1])], clr_any] # ul, 337 if label == 5: return [clr_any, named_colors[color_of_square(state[5-1])], named_colors[color_of_square(state[26-1])]] # ur, 338 if label == 6: return [named_colors[color_of_square(state[17-1])], named_colors[color_of_square(state[6-1])], clr_any] # ufl, 339 if label == 7: return [named_colors[color_of_square(state[18-1])], named_colors[color_of_square(state[7-1])], clr_any] # uf, 340 if label == 8: return [named_colors[color_of_square(state[19-1])], named_colors[color_of_square(state[8-1])], named_colors[color_of_square(state[25-1])]] # urf, 341 if label == 17: return [named_colors[color_of_square(state[17-1])], named_colors[color_of_square(state[6-1])], clr_any] # flu 342 if label == 18: return [named_colors[color_of_square(state[18-1])], named_colors[color_of_square(state[7-1])], clr_any] # fu 343 if label == 19: return [named_colors[color_of_square(state[19-1])], named_colors[color_of_square(state[8-1])], named_colors[color_of_square(state[25-1])]] # fur 344 if label == 20: return [named_colors[color_of_square(state[20-1])], clr_any, clr_any] # fl 345 if label == 21: return [named_colors[color_of_square(state[21-1])], clr_any, named_colors[color_of_square(state[28-1])]] # fr 346 if label == 22: return [named_colors[color_of_square(state[22-1])], clr_any, clr_any] # fdl 347 if label == 23: return [named_colors[color_of_square(state[23-1])], clr_any, clr_any] # fd 348 if label == 24: return [named_colors[color_of_square(state[24-1])], clr_any, named_colors[color_of_square(state[30-1])]] # frd 349 if label == 25: return [named_colors[color_of_square(state[19-1])],named_colors[color_of_square(state[8-1])],named_colors[color_of_square(state[25-1])]] #rfu, 350 if label == 26: return [clr_any,named_colors[color_of_square(state[5-1])],named_colors[color_of_square(state[26-1])]] # ru, 351 if label == 27: return [clr_any,named_colors[color_of_square(state[3-1])],named_colors[color_of_square(state[27-1])]] # rub, 352 if label == 28: return [named_colors[color_of_square(state[21-1])],clr_any,named_colors[color_of_square(state[28-1])]] # rf, 353 if label == 29: return [clr_any,clr_any,named_colors[color_of_square(state[29-1])]] # rb, 354 if label == 30: return [named_colors[color_of_square(state[24-1])],clr_any,named_colors[color_of_square(state[30-1])]] # rdf, 355 if label == 31: return [clr_any,clr_any,named_colors[color_of_square(state[31-1])]] # rd, 356 if label == 32: return [clr_any,clr_any,named_colors[color_of_square(state[32-1])]] #rbd, 547 357 548 358 def plot3d_cubie(cnt, clrs): … … 768 578 769 579 """ 770 fcts = [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16,17,18,19,20,21,22,23,24,\ 771 25,26,27,28,29,30,31,32,33,34,35,36, 37,38,39,40,41,42,43,44,45,46,47,48 ] 580 fcts = range(1,49) 772 581 if g is not None: 773 582 return [g(i) for i in fcts] … … 882 691 return line1+line2+line3+line4+line5+line6+line7+line8+line9+line10+line11+line12+line13 883 692 884 def plot_cube(self, mv,title=True):693 def plot_cube(self, mv, title=True, colors = [lpurple, yellow, red, green, orange, blue]): 885 694 """ 886 695 Input the move mv, as a string in the Singmaster notation, … … 901 710 state = self.facets(g) 902 711 #print state 903 str_colors = [index2singmaster(state[x])+"("+str(color_of_square(x+1))+")" for x in range(48)] 904 colors = [eval(p) for p in str_colors] 905 centers = u_center(lpurple)+f_center(red)+l_center(yellow)+r_center(green)+d_center(blue)+b_center(orange) 906 clrs = centers+sum(colors) 712 cubies = [create_poly(index2singmaster(state[x]), color_of_square(x+1, colors)) for x in range(48)] 713 centers = [create_poly('%s_center' % "ulfrbd"[i], colors[i]) for i in range(6)] 714 clrs = sum(cubies) + sum(centers) 907 715 clrs.axes(show=False) 908 716 if title == True:
Note: See TracChangeset
for help on using the changeset viewer.
