GithubHelp home page GithubHelp logo

sq12phase's Introduction

sq12phase

Square One Solver

50 random states / second on my laptop.

I haven't checked whether the solution is correct LOL.

Algorithm: phase1: to square shape and fix parity phase2: solve

License GPLv3

Copyright (C) 2023  Shuang Chen

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

License MIT

Copyright (c) 2023 Chen Shuang

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

sq12phase's People

Contributors

cs0x7f avatar jfly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

lucasalfare

sq12phase's Issues

Certain puzzle states seem to break `getParity` method

When toying around with extremely simple puzzle states in tnoodle-lib, the optimal solver crashes with an ArrayIndexOutOfBoundsException right at https://github.com/thewca/tnoodle-lib/blob/master/sq12phase/src/main/java/cs/sq12phase/FullCube.java#L157

An example to reproduce this is (2, -4). I have used the following debug method to figure out the puzzle state:

int[] debugState() {
    int[] debug = new int[24];

    for (int i = 0; i < 24; i++) {
        debug[i] = pieceAt(i);
    }

    return debug;
}

For the above example, TNoodle yields the following "converted" FullCube output:
[1,2,3,3,4,5,5,6,7,7,0,1,12,15,15,14,9,9,8,11,11,10,13,13]

Upon further inspection, the initial error makes sense because the piece 1 (a corner that is 2 vertices wide) "wraps around" and thus makes cnt think it's a new piece. However, I am astonished that for > 100 random "long" scrambles, this problem does not occur and I can only forcibly reproduce it for extremely short scramble sequences.

I thus have two major suspicions:
(a) The getParity code acutally has a flaw
(b) The converter from TNoodle --> sq12phase is faulty, in which case I need input from either you or @jfly concerning https://github.com/thewca/tnoodle-lib/blob/master/scrambles/src/main/java/net/gnehzr/tnoodle/puzzle/SquareOnePuzzle.java#L244

Please advise how to proceed

Adapt WCA metrics for solution length

Hey! I'm currently maintaining TNoodle and sq1 is causing us a headache, because it slows down our integration tests by a ton. The reason is that we still use the sub-optimal solver before your fix.

I understand that I can just cherry-pick your recent commits, but we still cannot use your optimal solver because of conflicts with the turn metrics:

  • Your solver counts each U and D face turn individually, so (1, 2) is actually 2 moves
  • WCA Regulation 12c4 requires that each (U, D) group counts as 1 move

I have considered a "hacky" solution where your program counts each U and D as 0.5 moves, but that doesn't work because (1, 0) / (2, 3) becomes 2.5 moves when it should be 3 per WCA.

Apart from this initial idea, I have failed to implement this metric myself because the code is too advanced for me ๐Ÿ™ˆ
Is there any chance you could implement 12c4 metrics either here directly or as a PR on our separate sq12phase clone over at https://github.com/thewca/tnoodle-lib ?

Thanks a lot for your help! :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.