Skip to content

Array representation of cube? #19

@PAK90

Description

@PAK90

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions