/* Testing the rectangle_symmetries module in Picat. Here are some tests of the rectangle_symmetries module. This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import rectangle_symmetries. main => go. /* Shape: x x x Represented as [[1,0], [2,3]], OnlyRotate = true */ go ?=> Shape = [[1,0], [2,3]], generate_symmetries(Shape, true, Symmetries), foreach(S in Symmetries) foreach(Row in S) println(Row) end, nl end, nl. go => true. /* Some different shapes and OnlyRotate=true|false [shape = [[1,0],[2,3]],onlyRotate = true] [1,0] [2,3] [2,1] [3,0] [3,2] [0,1] [0,3] [1,2] [shape = [[1,0],[2,3]],onlyRotate = false] [1,0] [2,3] [2,1] [3,0] [3,2] [0,1] [0,3] [1,2] [2,3] [1,0] [0,1] [3,2] [1,2] [0,3] [3,0] [2,1] [shape = [[1,0],[1,1]],onlyRotate = true] [1,0] [1,1] [1,1] [1,0] [1,1] [0,1] [0,1] [1,1] [shape = [[1,0],[1,1]],onlyRotate = false] [1,0] [1,1] [1,1] [1,0] [1,1] [0,1] [0,1] [1,1] [shape = [[1,2,3,4]],onlyRotate = true] [1,2,3,4] [1] [2] [3] [4] [4,3,2,1] [4] [3] [2] [1] [shape = [[1,2,3,4]],onlyRotate = false] [1,2,3,4] [1] [2] [3] [4] [4,3,2,1] [4] [3] [2] [1] [shape = [[1,1,1,1]],onlyRotate = true] [1,1,1,1] [1] [1] [1] [1] [shape = [[1,1,1,1]],onlyRotate = false] [1,1,1,1] [1] [1] [1] [1] */ go2 ?=> Shapes = [ [[1,0], [2,3]], [[1,0], [1,1]], [[1,2,3,4]], [[1,1,1,1]] ], member(Shape,Shapes), member(OnlyRotate,[true,false]), println([shape=Shape,onlyRotate=OnlyRotate]), Symmetries = generate_distinct_symmetries(Shape, OnlyRotate), foreach(S in Symmetries) foreach(Row in S) println(Row) end, nl end, nl, fail, nl. go2 => true.