diff --git a/code/cube.py b/code/cube.py index 428e6b7..a1d4b1c 100644 --- a/code/cube.py +++ b/code/cube.py @@ -46,6 +46,7 @@ """ +from __future__ import print_function import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Rectangle @@ -145,7 +146,7 @@ def move(self, f, l, d): self.stickers[i] = np.rot90(self.stickers[i], 3) if l == self.N - 1: self.stickers[i2] = np.rot90(self.stickers[i2], 1) - print "moved", f, l, len(ds) + print("moved", f, l, len(ds)) return None def _rotate(self, args): diff --git a/code/simple_cube.py b/code/simple_cube.py index f909f96..213e297 100644 --- a/code/simple_cube.py +++ b/code/simple_cube.py @@ -133,13 +133,17 @@ class CubeAxes(Axes): The cube has side-length 2, and the observer is a distance zloc away along the z-axis. """ - face = np.array([[1, 1], [1, -1], [-1, -1], [-1, 1], [1, 1]]) - faces = np.array([np.hstack([face[:, :i], + + def faces(): + face = np.array([[1, 1], [1, -1], [-1, -1], [-1, 1], [1, 1]]) + return np.array([np.hstack([face[:, :i], np.ones((5, 1)), face[:, i:]]) for i in range(3)] + [np.hstack([face[:, :i], -np.ones((5, 1)), face[:, i:]]) for i in range(3)]) + faces = faces() + stickercolors = ["#ffffff", "#00008f", "#ff6f00", "#ffcf00", "#009f0f", "#cf0000"]