Source

cl-permutation / examples / rubik-like.lisp

Full commit
;;;; examples/rubik-like.lisp
;;;;
;;;; Copyright (c) 2014 Robert Smith

(in-package #:cl-permutation-examples)

;;; Order: 3674160
;;       +--+--+
;;       |5 |6 |
;;       +--+--+
;;       |7 |8 |
;; +--+--+--+--+--+--+--+--+
;; |19|20|1 |2 |9 |10|13|14|
;; +--+--+--+--+--+--+--+--+
;; |xx|21|3 |4 |11|12|15|xx|
;; +--+--+--+--+--+--+--+--+
;;       |16|17|
;;       +--+--+
;;       |xx|18|
;;       +--+--+

(defun make-rubik-2x2 ()
  (group-from-cycles
   (list (list (make-cycle 1 2 4 3)     ; F
               (make-cycle 7 9 17 21)
               (make-cycle 8 11 16 20))

         (list (make-cycle 5 6 8 7)     ; U
               (make-cycle 2 20 14 10)
               (make-cycle 1 19 13 9))

         (list (make-cycle 9 10 12 11)  ; R
               (make-cycle 2 6 15 17)
               (make-cycle 4 8 13 18)))
   21))

;; 43252003274489856000
(defun make-rubik-3x3 ()
  (group-from-cycles   
   (list (list (make-cycle 11 35 27 19) 
               (make-cycle 10 34 26 18) 
               (make-cycle 9 33 25 17)
               (make-cycle 2 5 7 4)
               (make-cycle 1 3 8 6))
         
         (list (make-cycle 10 13 15 12)
               (make-cycle 9 11 16 14)
               (make-cycle 6 22 46 35)
               (make-cycle 4 20 44 37)
               (make-cycle 1 17 41 40))
         
         (list (make-cycle 18 21 23 20)
               (make-cycle 17 19 24 22)
               (make-cycle 8 30 41 11)
               (make-cycle 7 28 42 13)
               (make-cycle 6 25 43 16))
         
         (list (make-cycle 26 29 31 28)
               (make-cycle 25 27 32 30)
               (make-cycle 8 33 48 24)
               (make-cycle 5 36 45 21)
               (make-cycle 3 38 43 19))
         
         (list (make-cycle 34 37 39 36)
               (make-cycle 33 35 40 38)
               (make-cycle 3 9 46 32)
               (make-cycle 2 12 47 29)
               (make-cycle 1 14 48 27))
         
         (list (make-cycle 42 45 47 44)
               (make-cycle 41 43 48 46)
               (make-cycle 16 24 32 40)
               (make-cycle 15 23 31 39)
               (make-cycle 14 22 30 38)))
   48))                                 ; size

;;; Doesn't work *as intended*
(defun make-rubik-4x4 ()
  (group-from
   '((4 8 12 16 3 7 11 15 2 6 10 14 1 5 9 13
     65 66 67 68 21 22 23 24 25 26 27 28 29 30 31 32
     17 18 19 20 37 38 39 40 41 42 43 44 45 46 47 48
     33 34 35 36 53 54 55 56 57 58 59 60 61 62 63 64
     49 50 51 52 69 70 71 72 73 74 75 76 77 78 79 80
     81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96)
    (1 2 3 4 5 6 7 8 9 10 11 12 49 53 57 61
     17 18 19 16 21 22 23 15 25 26 27 14 29 30 31 13
     36 40 44 48 35 39 43 47 34 38 42 46 33 37 41 45
     84 50 51 52 83 54 55 56 82 58 59 60 81 62 63 64
     65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
     20 24 28 32 85 86 87 88 89 90 91 92 93 94 95 96)
    (1 2 3 77 5 6 7 73 9 10 11 69 13 14 15 65
     17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
     33 34 35 4 37 38 39 8 41 42 43 12 45 46 47 16
     52 56 60 64 51 55 59 63 50 54 58 62 49 53 57 61
     96 66 67 68 92 70 71 72 88 74 75 76 84 78 79 80
     81 82 83 36 85 86 87 40 89 90 91 44 93 94 95 48)
    (33 2 3 4 37 6 7 8 41 10 11 12 45 14 15 16
     20 24 28 32 19 23 27 31 18 22 26 30 17 21 25 29
     81 34 35 36 85 38 39 40 89 42 43 44 93 46 47 48
     49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
     65 66 67 13 69 70 71 9 73 74 75 5 77 78 79 1
     80 82 83 84 76 86 87 88 72 90 91 92 68 94 95 96)
    (1 2 3 17 5 6 7 21 9 10 11 25 13 14 15 29
     96 18 19 20 92 22 23 24 88 26 27 28 84 30 31 32
     33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
     49 50 51 4 53 54 55 8 57 58 59 12 61 62 63 16
     68 72 76 80 67 71 75 79 66 70 74 78 65 69 73 77
     81 82 83 64 85 86 87 60 89 90 91 56 93 94 95 52)
    (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 45 46 47 48
     33 34 35 36 37 38 39 40 41 42 43 44 61 62 63 64
     49 50 51 52 53 54 55 56 57 58 59 60 77 78 79 80
     65 66 67 68 69 70 71 72 73 74 75 76 29 30 31 32
     84 88 92 96 83 87 91 95 82 86 90 94 81 85 89 93)
    (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     17 18 19 20 69 70 71 72 25 26 27 28 29 30 31 32
     33 34 35 36 21 22 23 24 41 42 43 44 45 46 47 48
     49 50 51 52 37 38 39 40 57 58 59 60 61 62 63 64
     65 66 67 68 53 54 55 56 73 74 75 76 77 78 79 80
     81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96)
    (1 2 3 4 5 6 7 8 50 54 58 62 13 14 15 16
     17 18 12 20 21 22 11 24 25 26 10 28 29 30 9 32
     33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
     49 88 51 52 53 87 55 56 57 86 59 60 61 85 63 64
     65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
     81 82 83 84 19 23 27 31 89 90 91 92 93 94 95 96)
    (1 2 78 4 5 6 74 8 9 10 70 12 13 14 66 16
     17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
     33 34 3 36 37 38 7 40 41 42 11 44 45 46 15 48
     49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
     65 95 67 68 69 91 71 72 73 87 75 76 77 83 79 80
     81 82 35 84 85 86 39 88 89 90 43 92 93 94 47 96)
    (1 34 3 4 5 38 7 8 9 44 11 12 13 46 15 16
     17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
     33 82 35 36 37 86 39 40 41 42 43 90 45 94 47 48
     49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
     65 66 14 68 69 70 10 72 73 74 6 76 77 78 2 80
     81 79 83 84 85 75 87 88 89 71 91 92 93 67 95 96)
    (1 2 3 4 30 26 22 18 9 10 11 12 13 14 15 16
     17 89 19 20 21 90 23 24 25 91 27 28 29 92 31 32
     33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
     49 50 5 52 53 54 6 56 57 7 59 60 61 62 8 64
     65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
     81 82 83 84 85 86 87 88 63 58 55 51 93 94 95 96)
    (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
     17 18 19 20 21 22 23 24 41 42 43 44 29 30 31 32
     33 34 35 36 37 38 39 40 57 58 59 60 45 46 47 48
     49 50 51 52 53 54 55 56 73 74 75 76 61 62 63 64
     65 66 67 68 69 70 71 72 25 26 27 28 77 78 79 80
     81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96))))

;;; 100669616553523347122516032313645505168688116411019768627200000000000
(defun make-megaminx ()
  (group-from-cycles
   (list
    (list (make-cycle 1 9 7 5 3)
          (make-cycle 50 40 30 200 11)
          (make-cycle 52 42 32 22 13)
          (make-cycle 2 10 8 6 4)
          (make-cycle 51 41 31 21 12))

    (list (make-cycle 11 13 15 17 19)
          (make-cycle 3 200 72 62 54)
          (make-cycle 5 28 70 60 52)
          (make-cycle 12 14 16 18 20)
          (make-cycle 4 29 71 61 53))

    (list (make-cycle 200 22 24 26 28)
          (make-cycle 5 30 82 74 15)
          (make-cycle 7 38 80 72 13)
          (make-cycle 21 23 25 27 29)
          (make-cycle 6 39 81 73 14))

    (list (make-cycle 30 32 34 36 38)
          (make-cycle 7 40 92 84 24)
          (make-cycle 9 48 90 82 22)
          (make-cycle 31 33 35 37 39)
          (make-cycle 8 49 91 83 23))

    (list (make-cycle 40 42 44 46 48)
          (make-cycle 9 50 114 94 34)
          (make-cycle 1 58 112 92 32)
          (make-cycle 41 43 45 47 49)
          (make-cycle 10 59 113 93 33))

    (list (make-cycle 50 52 54 56 58)
          (make-cycle 1 11 60 116 44)
          (make-cycle 3 19 68 114 42)
          (make-cycle 51 53 55 57 59)
          (make-cycle 2 20 69 115 43))

    (list (make-cycle 60 62 64 66 68)
          (make-cycle 19 70 106 118 56)
          (make-cycle 17 78 104 116 54)
          (make-cycle 61 63 65 67 69)
          (make-cycle 18 79 105 117 55))

    (list (make-cycle 70 72 74 76 78)
          (make-cycle 17 28 80 108 64)
          (make-cycle 15 26 88 106 62)
          (make-cycle 71 73 75 77 79)
          (make-cycle 16 27 89 107 63))

    (list (make-cycle 80 82 84 86 88)
          (make-cycle 26 38 90 100 76)
          (make-cycle 24 36 98 108 74)
          (make-cycle 81 83 85 87 89)
          (make-cycle 25 37 99 109 75))
    
    (list (make-cycle 90 92 94 96 98)
          (make-cycle 36 48 112 102 86)
          (make-cycle 34 46 110 100 84)
          (make-cycle 91 93 95 97 99)
          (make-cycle 35 47 111 101 85))

    (list (make-cycle 100 102 104 106 108)
          (make-cycle 98 110 66 78 88)
          (make-cycle 96 118 64 76 86)
          (make-cycle 101 103 105 107 109)
          (make-cycle 97 119 65 77 87))

    (list (make-cycle 110 112 114 116 118)
          (make-cycle 96 46 58 68 104)
          (make-cycle 94 44 56 66 102)
          (make-cycle 111 113 115 117 119)
          (make-cycle 95 45 57 67 103)))
   200))                                ; size