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)
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()
def test_hypercube_constructor_correct_coordinates(): assert Hypercube(correct_coords)
def test_hypercube_constructor_empty_coordinates(): with pytest.raises(ValueError): assert Hypercube([])
def test_hypercube_constructor_nonumbers_coordinates(): with pytest.raises(ValueError): assert Hypercube(no_numbers_coords)
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")
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()