{"id":34343830,"url":"https://github.com/cs0x7f/min2phase","last_synced_at":"2026-03-11T20:32:53.520Z","repository":{"id":3749427,"uuid":"4824564","full_name":"cs0x7f/min2phase","owner":"cs0x7f","description":"Rubik's Cube Solver. An optimized implementation of Kociemba's two-phase algorithm.","archived":false,"fork":false,"pushed_at":"2023-02-21T03:29:19.000Z","size":247,"stargazers_count":286,"open_issues_count":6,"forks_count":57,"subscribers_count":20,"default_branch":"master","last_synced_at":"2023-10-20T19:06:48.183Z","etag":null,"topics":["rubik-cube-solver","rubiks-cube","two-phase-algorithm"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cs0x7f.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-06-28T19:21:19.000Z","updated_at":"2023-09-15T22:46:51.000Z","dependencies_parsed_at":"2022-08-10T17:30:54.182Z","dependency_job_id":"e57432f0-8e31-4e11-969f-6a9938b6e1b0","html_url":"https://github.com/cs0x7f/min2phase","commit_stats":{"total_commits":118,"total_committers":4,"mean_commits":29.5,"dds":0.09322033898305082,"last_synced_commit":"4d183b9eff8119cac72bc50ef35a7d8990740e06"},"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/cs0x7f/min2phase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cs0x7f%2Fmin2phase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cs0x7f%2Fmin2phase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cs0x7f%2Fmin2phase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cs0x7f%2Fmin2phase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cs0x7f","download_url":"https://codeload.github.com/cs0x7f/min2phase/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cs0x7f%2Fmin2phase/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30399354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T18:46:22.935Z","status":"ssl_error","status_checked_at":"2026-03-11T18:46:17.045Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["rubik-cube-solver","rubiks-cube","two-phase-algorithm"],"created_at":"2025-12-17T23:18:05.256Z","updated_at":"2026-03-11T20:32:53.507Z","avatar_url":"https://github.com/cs0x7f.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# min2phase\n- Rubik's Cube solver or scrambler. [![Build Status](https://travis-ci.org/cs0x7f/min2phase.svg?branch=master)](https://travis-ci.org/cs0x7f/min2phase)\n\n# Usage\n\n```java\nimport cs.min2phase.Search;\nimport cs.min2phase.Tools;\n\npublic class demo {\n\n    public static void simpleSolve(String scrambledCube) {\n        String result = new Search().solution(scrambledCube, 21, 100000000, 0, 0);\n        System.out.println(result);\n        // R2 U2 B2 L2 F2 U' L2 R2 B2 R2 D  B2 F  L' F  U2 F' R' D' L2 R'\n    }\n\n    public static void outputControl(String scrambledCube) {\n        String result = new Search().solution(scrambledCube, 21, 100000000, 0, Search.APPEND_LENGTH);\n        System.out.println(result);\n        // R2 U2 B2 L2 F2 U' L2 R2 B2 R2 D  B2 F  L' F  U2 F' R' D' L2 R' (21f)\n\n        result = new Search().solution(scrambledCube, 21, 100000000, 0, Search.USE_SEPARATOR | Search.INVERSE_SOLUTION);\n        System.out.println(result);\n        // R  L2 D  R  F  U2 F' L  F' .  B2 D' R2 B2 R2 L2 U  F2 L2 B2 U2 R2\n    }\n\n    public static void findShorterSolutions(String scrambledCube) {\n        //Find shorter solutions (try more probes even a solution has already been found)\n        //In this example, we try AT LEAST 10000 phase2 probes to find shorter solutions.\n        String result = new Search().solution(scrambledCube, 21, 100000000, 10000, 0);\n        System.out.println(result);\n        // L2 U  D2 R' B  U2 L  F  U  R2 D2 F2 U' L2 U  B  D  R'\n    }\n\n    public static void continueSearch(String scrambledCube) {\n        //Continue to find shorter solutions\n        Search searchObj = new Search();\n        String result = searchObj.solution(scrambledCube, 21, 500, 0, 0);\n        System.out.println(result);\n        // R2 U2 B2 L2 F2 U' L2 R2 B2 R2 D  B2 F  L' F  U2 F' R' D' L2 R'\n\n        result = searchObj.next(500, 0, 0);\n        System.out.println(result);\n        // D2 L' D' L2 U  R2 F  B  L  B  D' B2 R2 U' R2 U' F2 R2 U' L2\n\n        result = searchObj.next(500, 0, 0);\n        System.out.println(result);\n        // L' U  B  R2 F' L  F' U2 L  U' B' U2 B  L2 F  U2 R2 L2 B2\n\n        result = searchObj.next(500, 0, 0);\n        System.out.println(result);\n        // Error 8, no solution is found after 500 phase2 probes. Let's try more probes.\n\n        result = searchObj.next(500, 0, 0);\n        System.out.println(result);\n        // L2 U  D2 R' B  U2 L  F  U  R2 D2 F2 U' L2 U  B  D  R'\n    }\n\n    public static void main(String[] args) {\n        // Full initialization, which will take about 200ms.\n        // The solver will be about 5x~10x slower without full initialization.\n        long startTime = System.nanoTime();\n        Search.init();\n        System.out.println(\"Init time: \" + (System.nanoTime() - startTime) / 1.0E6 + \" ms\");\n\n        /** prepare scrambledCube as\n         *\n         *             |************|\n         *             |*U1**U2**U3*|\n         *             |************|\n         *             |*U4**U5**U6*|\n         *             |************|\n         *             |*U7**U8**U9*|\n         *             |************|\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         *             |************|\n         *             |*D1**D2**D3*|\n         *             |************|\n         *             |*D4**D5**D6*|\n         *             |************|\n         *             |*D7**D8**D9*|\n         *             |************|\n         *\n         * -\u003e U1 U2 ... U9 R1 ... R9 F1 ... F9 D1 ... D9 L1 ... L9 B1 ... B9\n         */\n        String scrambledCube = \"DUUBULDBFRBFRRULLLBRDFFFBLURDBFDFDRFRULBLUFDURRBLBDUDL\";\n        // scrambledCube can also be obtained by specific moves\n        scrambledCube = Tools.fromScramble(\"R L2 D R F U2 F' L F' B2 D' R2 B2 R2 L2 U F2 L2 B2 U2 R2\");\n        System.out.println(scrambledCube);\n\n        simpleSolve(scrambledCube);\n        outputControl(scrambledCube);\n        findShorterSolutions(scrambledCube);\n        continueSearch(scrambledCube);\n    }\n}\n```\n\n# License GPLv3\n\n    Copyright (C) 2023  Shuang Chen\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n\n# License MIT\n\n    Copyright (c) 2023 Chen Shuang\n\n    Permission is hereby granted, free of charge, to any person obtaining a copy\n    of this software and associated documentation files (the \"Software\"), to deal\n    in the Software without restriction, including without limitation the rights\n    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n    copies of the Software, and to permit persons to whom the Software is\n    furnished to do so, subject to the following conditions:\n\n    The above copyright notice and this permission notice shall be included in all\n    copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n    SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcs0x7f%2Fmin2phase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcs0x7f%2Fmin2phase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcs0x7f%2Fmin2phase/lists"}