예제 #1
0
    def create_grids_structure(self):
        """
        Creates Hypercube objects for every index in the multidimensional self.hypercubes list.

        """
        for indices, hypercube in np.ndenumerate(self.hypercubes):
            self.hypercubes[indices] = Hypercube(coords=indices)
예제 #2
0
파일: main.py 프로젝트: jamesl33/pycube
class CubeSimulation():
    def __init__(self):
        self._display = pygame.display.set_mode(DISPLAY.size)
        self._background = pygame.Surface(BACKGROUND.size)
        self._clock = pygame.time.Clock()
        self._hypercube = Hypercube()
        self._cube = Cube()

    def start(self):
        while True:
            self._update()

    def _update(self):
        self._clock.tick(FPS)
        self._handle_input(pygame.key.get_pressed())
        self._display.fill((0, 0, 0))

        self._cube.rotateX(0.5)
        self._cube.rotateY(0.25)
        self._cube.draw(self._display)

        self._hypercube.rotateY(0.5)
        self._hypercube.rotateW(0.25)
        self._hypercube.draw(self._display)

        pygame.display.update()

    def _handle_input(self, keys):
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                exit()
예제 #3
0
def test_hypercube_constructor_correct_coordinates():
    assert Hypercube(correct_coords)
예제 #4
0
def test_hypercube_constructor_empty_coordinates():
    with pytest.raises(ValueError):
        assert Hypercube([])
예제 #5
0
def test_hypercube_constructor_nonumbers_coordinates():
    with pytest.raises(ValueError):
        assert Hypercube(no_numbers_coords)
예제 #6
0
def test_hypercube_constructor_not_only_numerical_coordinates():
    with pytest.raises(ValueError):
        assert Hypercube(not_only_numerical_coords)
from hypercube import Hypercube
from hypercube_coloring import HypercubeColoring
"""
n=4
h = Hypercube(n)
print(h.enumerate_edges())
for g in h.generate_all_colorings():
    col = HypercubeColoring(n,g)
    switch_vec = col.find_switch_vector()
    print(switch_vec)
"""

n = 4
h = Hypercube(n)
for i in range(100):
    col = h.generate_random_coloring()
    col = HypercubeColoring(n, col)
    switch_vec = col.find_switch_vector()
    print(switch_vec)

print("la ende")
예제 #8
0
파일: main.py 프로젝트: jamesl33/pycube
 def __init__(self):
     self._display = pygame.display.set_mode(DISPLAY.size)
     self._background = pygame.Surface(BACKGROUND.size)
     self._clock = pygame.time.Clock()
     self._hypercube = Hypercube()
     self._cube = Cube()