[Python] Some Cube solver using Python/SageMath

Discussão em 'Python' iniciado por Stack, Novembro 29, 2024.

  1. Stack

    Stack Membro Participativo

    I'm new in SageMath/Python and I try to use the Tiling Solver.

    I failed to retrieve the 240 expected solutions of the Soma Cube (see the Wikipedia page).

    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')


    # 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()

    T.number_of_solutions() #returns 15 504 instead of 240 ??


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

    Do you have any ideas here?

    Continue reading...

Compartilhe esta Página