24 println(s" ** Total Memory: ${runtime.totalMemory / mb}") |
24 println(s" ** Total Memory: ${runtime.totalMemory / mb}") |
25 println(s" ** Max Memory: ${runtime.maxMemory / mb}") |
25 println(s" ** Max Memory: ${runtime.maxMemory / mb}") |
26 } |
26 } |
27 |
27 |
28 |
28 |
29 abstract class Colour |
29 enum Colour { |
30 case object White extends Colour |
30 case White |
31 case object Yellow extends Colour |
31 case Yellow |
32 case object Orange extends Colour |
32 case Orange |
33 case object Red extends Colour |
33 case Red |
34 case object Green extends Colour |
34 case Green |
35 case object Blue extends Colour |
35 case Blue |
|
36 } |
|
37 import Colour._ |
36 |
38 |
37 // Faces |
39 // Faces |
38 // ------- |
40 // ------- |
39 // |c11 c12| |
41 // |c11 c12| |
40 // |c21 c22| |
42 // |c21 c22| |
100 Face(c.f4.c11, c.f4.c12, c.f6.c12, c.f6.c11), |
102 Face(c.f4.c11, c.f4.c12, c.f6.c12, c.f6.c11), |
101 Face(c.f4.c22, c.f4.c21, c.f5.c21, c.f5.c22), |
103 Face(c.f4.c22, c.f4.c21, c.f5.c21, c.f5.c22), |
102 Face(c.f1.c11, c.f1.c12, c.f6.c21, c.f6.c22)) |
104 Face(c.f1.c11, c.f1.c12, c.f6.c21, c.f6.c22)) |
103 |
105 |
104 |
106 |
105 // simple bf-search without generating a solution, just true |
107 // simple bf-search without generating a |
|
108 // solution, just true in case there is a solution |
106 |
109 |
107 def actions(c: Cube) : List[Cube] = |
110 def actions(c: Cube) : List[Cube] = |
108 List(up(c), clock(c), right(c)) |
111 List(up(c), clock(c), right(c)) |
109 |
112 |
110 def search(cs: List[Cube], d: Int) : Boolean = { |
113 def search(cs: List[Cube], d: Int) : Boolean = { |