I have need of an array representation of the cube, either as a flat array or an array of six arrays for each face. I haven't found anything existing to do this, so I've come up with my own hacky method, but this feels like something that should be part of the Cube class. Here's what I did:
def cubeAsArray(cube):
faces = ["L", "R", "U", "D", "B", "F"]
cubeArray = []
for face in faces:
face = cube.get_face(face) # get face, iterate over all squares.
for x in [0,1,2]:
for y in [0,1,2]:
cubeArray.append(str(face[x][y]))
return cubeArray
I have need of an array representation of the cube, either as a flat array or an array of six arrays for each face. I haven't found anything existing to do this, so I've come up with my own hacky method, but this feels like something that should be part of the Cube class. Here's what I did: