Skip to main content

Nxnxn Rubik | 39scube Algorithm Github Python Verified

my_cube.apply_algorithm(solution) assert my_cube.is_solved(), "Verification failed!"

Output:

Is cube solved after scramble? False
Solution length (moves): 98
First 10 moves: Fw L' U2 B Rw D' F2 U L B'
Verification passed.
from nxnxn_solver import CubeSolver
def solve_NxNxN(cube):
    # 1. Pair centers (N-2)//2 layers
    for layer in range((cube.N - 2) // 2):
        solve_center_layer(cube, layer)
# 2. Pair edges
pair_all_edges(cube)
# 3. Fix parity (OLL parity, PLL parity for even N)
fix_parity(cube)
# 4. Solve as 3x3x3
solve_3x3(cube.to_3x3_representation())
return move_sequence


solution = my_cube.solve() print("Solution length (moves):", len(solution.split())) print("First 10 moves:", solution[:50]) nxnxn rubik 39scube algorithm github python verified

Original stars: 200+ for 3x3, but community forks add NxNxN support.

The original pycuber was a beautiful 3x3 solver. Forks like pycuber-nxn extend it to NxNxN with a twist: they implement Thistlethwaite's algorithm for all N, not just reduction. my_cube

Verification method: Every stage's move set is proven to reduce the cube to the next subgroup (G1 → G2 → G3 → solved). The code checks that after each phase, the cube belongs to the correct subgroup using invariant scanning.