Skip to main content

SECS++ Rubik's Cube Solver using phased and looped solving logic

Project description

SECS++ Cube Solver SECS++ is an intelligent, hybrid Rubik's Cube solver that combines a custom heuristic-driven A* search with a guaranteed optimal solver.

This package provides a robust and easy-to-use tool to find solutions for any valid 3x3 Rubik's Cube scramble. It first attempts to solve the cube using the innovative SECS++ algorithm. If the scramble proves too complex for the heuristic search, it seamlessly falls back to the powerful Kociemba algorithm to guarantee a correct and optimal solution.

Key Features Hybrid Solving Strategy: Prioritizes the custom A* search and uses Kociemba's algorithm as a robust failover, offering the best of both worlds.

Unique cubeeval Heuristic: Employs a novel heuristic that evaluates cube states based on both sticker misalignment and color entropy.

Simple API: A single function call to solve any scramble.

Phase-Based Logic: Breaks the problem down into logical stages (Cross, F2L, Last Layer) for its primary search.

Guaranteed Solutions: Never fails to solve a valid scramble.

Installation You can install the SECS++ Cube Solver directly from PyPI:

pip install secs-cube-solver

This package requires the kociemba-python library, which will be installed automatically as a dependency.

Quick Start & Usage Using the solver is straightforward. Import the main solve function from the package, provide a scramble string, and get the solution.

Here is a complete usage example:

Import the main solver function

from secs import solve

Define a scramble string (standard cube notation)

scramble = "R U R' U R U2 R' U"

print(f"Solving scramble: {scramble}")

Call the solver

The function returns the solution moves and the solver that found it

solution_moves, solver_type = solve(scramble)

Print the result

print(f"\nSolution found by: {solver_type}") print(f"Solved in {len(solution_moves)} moves:") print(' '.join(solution_moves))

Example Output:

Solving scramble: R U R' U R U2 R' U

Solution found by: SECS++ (A* with cubeeval heuristic) Solved in 8 moves: U' R U2 R' U' R U' R'

The SECS++ Algorithm The primary solver uses a phased A* search algorithm. The intelligence of this search is guided by a custom heuristic function, cubeeval(n), which evaluates the "cost" of any given cube state n.

The A* formula is: f(n)=g(n)+ textcubeeval(n)

Where:

g(n) is the number of moves already taken.

cubeeval(n) is our unique heuristic: a cdotH_diff(n)+b cdotE(n)

H_diff(n) measures sticker misalignment.

E(n) is a novel metric for color entropy (disorder) on each face.

If the A* search cannot find a solution within its configured limits, the package automatically calls Kociemba's algorithm to ensure a correct and optimal solution is always returned.

Author P. Jeba Selvan Andrew

GitHub Profile

License This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

secspp-0.1.2.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

secspp-0.1.2-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file secspp-0.1.2.tar.gz.

File metadata

  • Download URL: secspp-0.1.2.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for secspp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 cef4214c22696584735a548daeb0725bdbf5dfb6d6a1606da8f125ff8a50c773
MD5 666004c163fc46c6fb396ce81dda6b09
BLAKE2b-256 5cc5945f46de049120ad752f8d865d0cf7bf6e863ec309eb2d88599434768f88

See more details on using hashes here.

File details

Details for the file secspp-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: secspp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for secspp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 28c5252ac66f4309b87492bd31d08467239eda3800b2f52d3d060c24ee6b9e7a
MD5 c585af92cb415fc0814474735ad5ac9b
BLAKE2b-256 64938dc7d0479ef14cb59184b93e49a2b929531fb213c8213bd9ea064be19d12

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page