Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3 compatibility #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion code/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

"""

from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
Expand Down Expand Up @@ -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):
Expand Down
8 changes: 6 additions & 2 deletions code/simple_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down