def show_pentaminos(box=(5, 8, 2)): r""" Show the 17 3-D pentaminos included in the game and the `5 \times 8 \times 2` box where 16 of them must fit. INPUT: - ``box`` - tuple of size three (optional, default: ``(5,8,2)``), size of the box OUTPUT: 3D Graphic object EXAMPLES:: sage: from sage.games.quantumino import show_pentaminos sage: show_pentaminos() # not tested (1s) To remove the frame do:: sage: show_pentaminos().show(frame=False) # not tested (1s) """ G = Graphics() for i, p in enumerate(pentaminos): x = 3.5 * (i % 4) y = 3.5 * (i / 4) q = p + (x, y, 0) G += q.show3d() G += text3d(str(i), (x, y, 2)) G += cube(color='gray', opacity=0.5).scale(box).translate((17, 6, 0)) # hack to set the aspect ratio to 1 a, b = G.bounding_box() a, b = map(vector, (a, b)) G.frame_aspect_ratio(tuple(b - a)) return G
def show_pentaminos(box=(5, 8, 2)): r""" Show the 17 3-D pentaminos included in the game and the `5 \times 8 \times 2` box where 16 of them must fit. INPUT: - ``box`` - tuple of size three (optional, default: ``(5,8,2)``), size of the box OUTPUT: 3D Graphic object EXAMPLES:: sage: from sage.games.quantumino import show_pentaminos sage: show_pentaminos() # not tested (1s) To remove the frame do:: sage: show_pentaminos().show(frame=False) # not tested (1s) """ G = Graphics() for i, p in enumerate(pentaminos): x = 3.5 * (i % 4) y = 3.5 * (i / 4) q = p + (x, y, 0) G += q.show3d() G += text3d(str(i), (x, y, 2)) G += cube(color="gray", opacity=0.5).scale(box).translate((17, 6, 0)) # hack to set the aspect ratio to 1 a, b = G.bounding_box() a, b = map(vector, (a, b)) G.frame_aspect_ratio(tuple(b - a)) return G
def show3d(self, size=0.85): r""" Return the solution as a 3D Graphic object. OUTPUT: 3D Graphic Object EXAMPLES:: sage: from sage.games.quantumino import QuantuminoSolver sage: s = QuantuminoSolver(0).solve().next() # not tested (1.5s) sage: G = s.show3d() # not tested (<1s) sage: type(G) # not tested <class 'sage.plot.plot3d.base.Graphics3dGroup'> To remove the frame:: sage: G.show(frame=False) # not tested To see the solution with Tachyon viewer:: sage: G.show(viewer='tachyon', frame=False) # not tested """ G = Graphics() for p in self: G += p.show3d(size=size) aside_pento = self._aside.canonical() + (2.5 * size / 0.75, -4 * size / 0.75, 0) G += aside_pento.show3d(size=size) # hack to set the aspect ratio to 1 a, b = G.bounding_box() a, b = map(vector, (a, b)) G.frame_aspect_ratio(tuple(b - a)) return G