Ask Your Question
0

Use of Tiling solver for the Soma cube ? [closed]

asked 2024-11-29 11:32:47 +0100

DonutMan gravatar image

updated 2024-11-29 12:00:01 +0100

Hi, i'm new in SageMath and i try to use the Tiling Solver. I failed to retrieve the 240 expected solutions of the Soma Cube (see the Wikipedia page of it, sadmy my "Karma" is not good enough to share links with you...)

Here's what I've done so far :

from sage.combinat.tiling import TilingSolver, Polyomino
from sage.all_cmdline import *   # import sage library

P1 = Polyomino([(0,0,0), (0,0,1), (0,1,0)], color='red')
P2 = Polyomino([(0,0,0), (0,0,1), (0,1,0), (0,2,0)], color='red')
P3 = Polyomino([(0,0,0), (0,1,1), (0,1,0), (0,2,0)], color='red')
P4 = Polyomino([(0,0,1), (0,1,1), (0,1,0), (0,2,0)], color='red')
P5 = Polyomino([(0,0,0), (0,0,1), (1,0,1), (1,1,1)], color='red')
P6 = Polyomino([(0,0,0), (0,0,1), (1,0,1), (1,1,1)], color='red')
P7 = Polyomino([(0,0,0), (1,0,1), (1,0,0), (1,1,0)], color='red')

# These two lines let me check that the Polyomino are the ones expected...
# G = P1.show3d()
# G.show(aspect_ratio=1, viewer='jmol')

T = TilingSolver([P1, P2, P3, P4, P5, P6, P7], box=(3,3,3))
T.number_of_solutions() # Expected : 240 but got 15 504...

Perhaps some cube symetries are taken into account, but 15 504 / 240 = 64.6....

Do you have any ideas here ?

Thanks a lot !

BR

Pierre

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by DonutMan
close date 2024-12-04 14:49:40.451015

1 Answer

Sort by » oldest newest most voted
1

answered 2024-11-29 21:05:48 +0100

Sébastien gravatar image

updated 2024-11-29 21:26:15 +0100

The seven pieces are said to be different on the Cube Soma Wikipedia page, but you have defined P5 and P6 to be the same:

P5 = Polyomino([(0,0,0), (0,0,1), (1,0,1), (1,1,1)], color='red')
P6 = Polyomino([(0,0,0), (0,0,1), (1,0,1), (1,1,1)], color='red')

which I think is wrong. If you replace P6 by what follows:

P6 = Polyomino([(0,0,0), (1,0,0), (1,0,1), (1,1,1)], color='red')

Then, you get:

sage: T = TilingSolver([P1, P2, P3, P4, P5, P6, P7], box=(3,3,3))
sage: T.number_of_solutions()
11520

Each solution is counted 24 times because of the 24 orientation preserving isometries of the cube:

sage: from sage.combinat.tiling import ncube_isometry_group
sage: G = ncube_isometry_group(3, orientation_preserving=True)
sage: len(G)
24
sage: 11520 / 24
480

But, since the 7 pieces are globally closed under miror image (P5 and P6 get swaped), we can count solutions up to every isometries of the cube. There are 48 of them:

sage: G = ncube_isometry_group(3, orientation_preserving=False)
sage: len(G)
48

and thus we count

sage: 11520 / 48
240

non-isometric solutions.

When I computed the number of solutions to the Quantamino game, I avoided to compute many times the same isometric solutions by limiting the reflections for one fixed piece. See the method T._rows_mod_box_isometries(0) which provide a smaller list of rows for the dancing links solver.

edit flag offensive delete link more

Comments

Hello, wow thank you very much for this very detailed answer ! I didn't spot the error in my program.

BR

Pierre

DonutMan gravatar imageDonutMan ( 2024-12-04 14:48:10 +0100 )edit

Question Tools

1 follower

Stats

Asked: 2024-11-29 11:32:47 +0100

Seen: 117 times

Last updated: Nov 29