rapidcube

1from .rapidcube import *
2
3__doc__ = rapidcube.__doc__
4if hasattr(rapidcube, "__all__"):
5    __all__ = rapidcube.__all__
class CubeBatch:
def apply_move_indexes(self, /, move_indexes):

The type of the None singleton.

def get_next_states(self, /):

Return successor states for all cubes using the 12 quarter-turn moves.

Returns a NumPy int64 array with shape (len(self) * 12, sticker_dim).

def scramble(self, /, scramble_lengths):

Scramble each cube with the corresponding number of random moves.

The scramble_lengths array is zipped with the batch. If it is shorter than the batch, only the first N cubes are scrambled. Extra lengths are ignored.

def len(self, /):

Return the number of cubes in the batch.

class Cube2x2:

A compact 2x2 Rubik's Cube model with fast move operations.

def to_binary(self, /):

Return the corner and edge states as a tuple of 64-bit binary strings.

def get_corners(self, /):

Return the corner state as an array.

def to_sticker_array(self, /):

The type of the None singleton.

def is_solved(self, /):

Return true if the cube is solved.

def do_u_move(self, /):

Apply the U move (clockwise top face turn).

def do_u_prime_move(self, /):

Apply the U' move (counterclockwise top face turn).

def do_d_move(self, /):

Apply the D move (clockwise bottom face turn).

def do_d_prime_move(self, /):

Apply the D' move (counterclockwise bottom face turn).

def do_r_move(self, /):

Apply the R move (clockwise right face turn).

def do_r_prime_move(self, /):

Apply the R' move (counterclockwise right face turn).

def do_l_move(self, /):

Apply the L move (clockwise left face turn).

def do_l_prime_move(self, /):

Apply the L' move (counterclockwise left face turn).

def do_f_move(self, /):

Apply the F move (clockwise front face turn).

def do_f_prime_move(self, /):

Apply the F' move (counterclockwise front face turn).

def do_b_move(self, /):

Apply the B move (clockwise back face turn).

def do_b_prime_move(self, /):

Apply the B' move (counterclockwise back face turn).

def do_moves(self, /, moves):

Apply a whitespace-separated sequence of cube moves.

def scramble(self, /, scramble_length=20):

Apply a random scramble of the given length.

state
class Cube3x3:
def to_binary_corners(self, /):

Return the corner state as a 64-bit binary string.

def to_binary_edges(self, /):

Return the edge state as a 64-bit binary string.

def to_binary(self, /):

Return the corner and edge states as a tuple of 64-bit binary strings.

def get_corners(self, /):

Return the corner state as an array.

def get_edges(self, /):

Return the edge state as an array.

def to_sticker_array(self, /):

Return the cube state as an array of 54 sticker colors. The stickers are ordered as follows: U face (9 stickers), R face (9 stickers), D face (9 stickers), L face (9 stickers), L face (9 stickers), B face (9 stickers).

def is_solved(self, /):

Return true if the cube is solved.

def do_u_move(self, /):

Apply the U move (clockwise top face turn).

def do_u_prime_move(self, /):

Apply the U' move (counterclockwise top face turn).

def do_d_move(self, /):

Apply the D move (clockwise bottom face turn).

def do_d_prime_move(self, /):

Apply the D' move (counterclockwise bottom face turn).

def do_r_move(self, /):

Apply the R move (clockwise right face turn).

def do_r_prime_move(self, /):

Apply the R' move (counterclockwise right face turn).

def do_l_move(self, /):

Apply the L move (clockwise left face turn).

def do_l_prime_move(self, /):

Apply the L' move (counterclockwise left face turn).

def do_f_move(self, /):

Apply the F move (clockwise front face turn).

def do_f_prime_move(self, /):

Apply the F' move (counterclockwise front face turn).

def do_b_move(self, /):

Apply the B move (clockwise back face turn).

def do_b_prime_move(self, /):

Apply the B' move (counterclockwise back face turn).

def do_moves(self, /, moves):

Apply a whitespace-separated sequence of cube moves.

def scramble(self, /, scramble_length=20):

Apply a random scramble of the given length.

corners
def inverse_scramble(scramble):

Return the inverse of the given scramble string.

def get_next_states(cubes):

Return quarter-turn successors for a batch of 2x2 or 3x3 cubes.