1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
18 var commands
= ["U", "L", "F", "R", "B", "D", "M", "E", "S", "u", "l", "r", "b", "d", "X", "Y", "Z"]
20 for iters
in [1 .. commands
.length
[ do
21 var ref_rubix
= new RubixCube.solved
22 #alt1 ref_rubix = new RubixCube.scrambled
23 var combin
= new CombinationCollection[String](commands
, iters
)
24 combin
.are_sorted
= true
25 combin
.are_unique
= true
27 var rubix
= new RubixCube.solved
28 #alt1 rubix = new RubixCube.scrambled
29 var revcmd
= new Array[String].with_capacity
(cmd
.length
* 2)
30 for i
in cmd
do revcmd
.add i
31 for i
in cmd
.reverse_iterator
do revcmd
.add
("{i}'")
32 print
"Trying combination {revcmd}"
33 for i
in revcmd
do rubix
.do_cmd
(i
)
34 assert rubix
== ref_rubix
35 print
"Combination {revcmd} is OK."