{"id":17063173,"url":"https://github.com/tcbegley/cube-solver","last_synced_at":"2025-04-12T18:42:39.654Z","repository":{"id":47506383,"uuid":"125434738","full_name":"tcbegley/cube-solver","owner":"tcbegley","description":"A pure Python implementation of Herbert Kociemba's two-phase algorithm for solving the Rubik's Cube","archived":false,"fork":false,"pushed_at":"2023-06-20T16:07:47.000Z","size":81,"stargazers_count":17,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-26T12:51:17.659Z","etag":null,"topics":["cube","cube-solver","python","rubiks-cube","rubiks-cube-solver"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tcbegley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-03-15T22:46:06.000Z","updated_at":"2024-08-20T10:36:06.000Z","dependencies_parsed_at":"2022-09-11T22:51:39.415Z","dependency_job_id":"063d6f91-d424-44ed-886c-caff5665a0d2","html_url":"https://github.com/tcbegley/cube-solver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcbegley%2Fcube-solver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcbegley%2Fcube-solver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcbegley%2Fcube-solver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcbegley%2Fcube-solver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tcbegley","download_url":"https://codeload.github.com/tcbegley/cube-solver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248617115,"owners_count":21134190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cube","cube-solver","python","rubiks-cube","rubiks-cube-solver"],"created_at":"2024-10-14T10:51:39.875Z","updated_at":"2025-04-12T18:42:39.631Z","avatar_url":"https://github.com/tcbegley.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cube-solver\n\nA pure Python implementation of Herbert Kociemba's two-phase algorithm for solving the Rubik's Cube\n\n## Installation\n\nRequires Python 3. Install with\n\n```sh\npip install git+https://github.com/tcbegley/cube-solver.git\n```\n\nNote that depending on how your system is configured, you may need to replace `pip` with `pip3` in the above command to install for Python 3.\n\n## Usage\n\nTo solve a cube, just import the `solve` method and pass a cube string.\n\n```python\nfrom twophase import solve\n\nsolve(\"\u003ccube_string\u003e\")\n```\n\nWhere the cube string is a 54 character string, consisting of the characters U, R, F, D, L, B (corresponding to the Upper, Right, Front, Down, Left and Back faces). Each character corresponds to one of the 54 stickers on the cube:\n\n```plaintext\n             |------------|\n             |-U1--U2--U3-|\n             |------------|\n             |-U4--U5--U6-|\n             |------------|\n             |-U7--U8--U9-|\n|------------|------------|------------|------------|\n|-L1--L2--L3-|-F1--F2--F3-|-R1--R2--R3-|-B1--B2--B3-|\n|------------|------------|------------|------------|\n|-L4--L5--L6-|-F4--F5--F6-|-R4--R5--R6-|-B4--B5--B6-|\n|------------|------------|------------|------------|\n|-L7--L8--L9-|-F7--F8--F9-|-R7--R8--R9-|-B7--B8--B9-|\n|------------|------------|------------|------------|\n             |-D1--D2--D3-|\n             |------------|\n             |-D4--D5--D6-|\n             |------------|\n             |-D7--D8--D9-|\n             |------------|\n```\n\nand should be specified in the order U1-U9, R1-R9, F1-F9, D1-D9, L1-L9, B1-B9.\n\nFor example, a completely solved cube is represented by the string `\"UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLBBBBBBBBB\"`.\n\n`solve` will return a solution unless timeout has been reached (default is 10 seconds). Typically it will find a solution very quickly unless you set a low upper bound on the number of moves allowed. Note that the first time you run `solve`, it will precompute move tables needed for the solution which might take ~1 minute. Subsequent runs will be much faster.\n\nIf you want to keep searching for better solutions, use the `solve_best` or\n`solve_best_generator` functions. `solve_best` reduces `max_length` each time a\nsolution is found and continues searching for a better solution. All solutions\nfound are returned in a list at the end. `solve_best_generator` creates a\ngenerator that yields solutions as they are found.\n\n```python\nfrom twophase import solve_best, solve_best_generator\n\n# returns a list of solutions\nsolve_best(\"\u003ccube_string\u003e\")\n\n# creates a generator that yields solutions as they are found\nsolve_best_generator(\"\u003ccube_string\u003e\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcbegley%2Fcube-solver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftcbegley%2Fcube-solver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcbegley%2Fcube-solver/lists"}