Code Monkey home page Code Monkey logo

rubikscube-twophasesolver's People

Contributors

hkociemba avatar tazeg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rubikscube-twophasesolver's Issues

Tables files

This is not issue, just a question.
The files generated on first run this program. What are these files? And why we need these file?

list index out of range

Hi, i tried to solve some cubes on a raspberry with your great software on a raspberry.

here is what i get when i send this to the server:
echo DDDDUDDDDRRRRRRRRRBBBBFBBBBUUUUDUUUULLLLLLLLLFFFFBFFFF |nc 127.0.0.1 8080

pi@raspberrypi:~/RubiksCube-TwophaseSolver $ python3 start_server.py

loading conj_twist table...
loading conj_ud_edges table...
loading flipslice sym-tables...
loading move_twist table...
loading move_flip table...
loading move_slice_sorted table...
loading move_u_edges table...
loading move_d_edges table...
loading move_ud_edges table...
loading move_corners table...
loading phase1_prun table...
loading phase2_prun table...
loading phase2_cornsliceprun table...
startserver
Server socket created
Server now listening...
Connected with 127.0.0.1:40968, 2017.10.28  12:16:34
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/home/pi/RubiksCube-TwophaseSolver/solver.py", line 193, in run
    self.search(self.co_cube.flip, self.co_cube.twist, self.co_cube.slice_sorted, dist, togo1)
  File "/home/pi/RubiksCube-TwophaseSolver/solver.py", line 114, in search
    m = self.sofar_phase1[-1]
IndexError: list index out of range

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/home/pi/RubiksCube-TwophaseSolver/solver.py", line 193, in run
    self.search(self.co_cube.flip, self.co_cube.twist, self.co_cube.slice_sorted, dist, togo1)
  File "/home/pi/RubiksCube-TwophaseSolver/solver.py", line 114, in search
    m = self.sofar_phase1[-1]
IndexError: list index out of range

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/home/pi/RubiksCube-TwophaseSolver/solver.py", line 193, in run
    self.search(self.co_cube.flip, self.co_cube.twist, self.co_cube.slice_sorted, dist, togo1)
  File "/home/pi/RubiksCube-TwophaseSolver/solver.py", line 114, in search
    m = self.sofar_phase1[-1]
IndexError: list index out of range

DDDDUDDDDRRRRRRRRRBBBBFBBBBUUUUDUUUULLLLLLLLLFFFFBFFFF
Connection closed

Even a already solved cube results in a server error

echo UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLBBBBBBBBB |nc 127.0.0.1 8080

pi@raspberrypi:~/RubiksCube-TwophaseSolver $ python3 start_server.py
loading conj_twist table...
loading conj_ud_edges table...
loading flipslice sym-tables...
loading move_twist table...
loading move_flip table...
loading move_slice_sorted table...
loading move_u_edges table...
loading move_d_edges table...
loading move_ud_edges table...
loading move_corners table...
loading phase1_prun table...
loading phase2_prun table...
loading phase2_cornsliceprun table...
startserver
Server socket created
Server now listening...
Connected with 127.0.0.1:40972, 2017.10.28  12:23:35
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/home/pi/RubiksCube-TwophaseSolver/solver.py", line 193, in run
    self.search(self.co_cube.flip, self.co_cube.twist, self.co_cube.slice_sorted, dist, togo1)
  File "/home/pi/RubiksCube-TwophaseSolver/solver.py", line 114, in search
    m = self.sofar_phase1[-1]
IndexError: list index out of range

UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLBBBBBBBBB
Connection closed

What am i doing wrong here, thanks, chester

EOFError: read() didn't return enough bytes

2020-12-02T12:49:17.639736+00:00 app[web.1]: loading conj_twist table...
2020-12-02T12:49:17.640385+00:00 app[web.1]: loading conj_ud_edges table...
2020-12-02T12:49:17.643817+00:00 app[web.1]: loading flipslice sym-tables...
2020-12-02T12:49:17.648517+00:00 app[web.1]: Traceback (most recent call last):
2020-12-02T12:49:17.648585+00:00 app[web.1]: File "start_server.py", line 3, in
2020-12-02T12:49:17.648830+00:00 app[web.1]: import sockets
2020-12-02T12:49:17.648859+00:00 app[web.1]: File "/app/sockets.py", line 6, in
2020-12-02T12:49:17.649051+00:00 app[web.1]: import solver
2020-12-02T12:49:17.649100+00:00 app[web.1]: File "/app/solver.py", line 5, in
2020-12-02T12:49:17.649299+00:00 app[web.1]: import symmetries as sy
2020-12-02T12:49:17.649337+00:00 app[web.1]: File "/app/symmetries.py", line 217, in
2020-12-02T12:49:17.649690+00:00 app[web.1]: flipslice_rep.fromfile(fh, N_FLIPSLICE_CLASS)
2020-12-02T12:49:17.649745+00:00 app[web.1]: EOFError: read() didn't return enough bytes

So i'am trying to use this on heroku but this error occurs

kociemba.org down

Hello !
Just to inform you that your web-site kociemba.org is down.
Thanks for your work :D

from enum import IntEnum

Hello there
I cant run this program , the file class enum.py is missing
this is being imported from enums.py
from enums import IntEnum

it doesn't run , do you have the type of IntEnum ? or the class ? so I can run it

Since opencv 3.2 findContours does not modify the source image

This resultes in an issue in vision2.py, line 262 in find_squares:

im2, contours, hierarchy = cv2.findContours(j, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

maybe this would render the code version proof:

major = cv2.__version__.split('.')[0]
if major == '3':
    im2, contours, hierarchy = cv2.findContours(j, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
else:
    contours, hierarchy = cv2.findContours(j, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

Sub-optimal / not solution to R1 U1 F1

I discovered this problem on my CUBOTino autonomous
Orientate the cube with Green F, White U
R1 U1 F1

Cube status (via BGR color distance): UUUUUULLDFBBFRRFRRFFRFFRDDRRRUDDBDDBFFDLLDLLBLLLUBBUBB
Camera warm-up, camera setting, cube status (BGR), and solution, in: 50.0 secs

Cube solution: 9 moves  F3 U1 D2 R2 L2 U2 D2 R1 L2
Robot moves string: applied optimization type 2
Total robot movements: 47

total amount of servo movements: 47

And it DOESN'T SOLVE

Testing just the RubikTwoPhase library:

On Pi Zero W
(Andrea Favero bult the code code, possibly on a Pi Zero 2 W, in case that is significant)

(.virtualenvs) root@cubotino:/home/pi/cubotino/src# python
Python 3.7.3 (default, Oct 31 2022, 14:04:00)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import twophase.solver  as sv
loading conj_twist table...
loading conj_ud_edges table...
loading flipslice sym-tables...
loading corner sym-tables...
loading move_twist table...
loading move_flip table...
loading move_slice_sorted table...
loading move_u_edges table...
loading move_d_edges table...
loading move_ud_edges table...
loading move_corners table...
loading phase1_prun table...
loading phase2_prun table...
loading phase2_cornsliceprun table...
>>> cubestring = 'UUUUUULLDFBBFRRFRRFFRFFRDDRRRUDDBDDBFFDLLDLLBLLLUBBUBB'
>>> sv.solve(cubestring,19,2)                                            
'F3 U1 D2 R2 L2 U2 D2 R1 L2 (9f)'
>>> 

(.virtualenvs) root@cubotino:/home/pi/cubotino/src# pip list | grep RubikTwoPhase
RubikTwoPhase         1.0.9

(.virtualenvs) root@cubotino:/home/pi/cubotino/src# uname -a
Linux cubotino 5.10.103+ #1529 Tue Mar 8 12:19:18 GMT 2022 armv6l GNU/Linux
(.virtualenvs) root@cubotino:/home/pi/cubotino/src# cat /proc/cpuinfo
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 797.66
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2835
Revision        : 9000c1
Serial          : 0000000083b98790
Model           : Raspberry Pi Zero W Rev 1.1

On Mac

(CUBOTino_venv) porta-mac:PC_files johnm$ python
Python 3.8.3 (v3.8.3:6f8c8320e9, May 13 2020, 16:29:34)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import twophase.solver as sv
loading conj_twist table...
loading conj_ud_edges table...
loading flipslice sym-tables...
loading corner sym-tables...
loading move_twist table...
loading move_flip table...
loading move_slice_sorted table...
loading move_u_edges table...
loading move_d_edges table...
loading move_ud_edges table...
loading move_corners table...
loading phase1_prun table...
loading phase2_prun table...
loading phase2_cornsliceprun table...
loading phase2_edgemerge table...
>>> cubestring = 'UUUUUULLDFBBFRRFRRFFRFFRDDRRRUDDBDDBFFDLLDLLBLLLUBBUBB'
>>> sv.solve(cubestring,19,2)
'F3 U3 R1 U2 D2 R2 L2 U2 D2 L2 (10f)'
>>> 
(CUBOTino_venv) porta-mac:CUBOT johnm$ pip list | grep RubikTwoPhase
RubikTwoPhase 1.1.1

10 Moves, but it is a solution.

Tables to sub-folder?

Hi, I want to use your solver for an app. Everything works fine so far. I just have a request of a more cosmetic nature. Is there any simple solution to move all the table files away from the root folder of my app and hide them in some sub-folder?

Solver fails to solve certain states

This solver fails to correctly solve the following state: UUUUUUUUURRRRRLRRRFFFFFBFFFDDDDDDDDDLLLLLRLLLBBBFBBBBB. The server simply responds with the empty solution string (0f) as if it were the solved state (which it isn't).

Some isomorphic states also produce this problem. Curiously, however, this doesn't appear to affect all isomorphic states. In particular, if I give it the isomorphic state UUUUUUUDURRRRRRRRRFFFFFFFBFDDDDDDDUDLLLLLLLLLBBBBBBBFB, then it's able to produce an 8f solution (R2 F2 R2 U2 L2 B2 L2 U2). Best I can tell, the bug occurs on all isomorphic states that keep the up and down slices solved.

webcam feature?

do you work on a webcam (RPI Camera) feature similar to cube explorer ?

Cam is not working correctly

Hi, I have a mac and the webcam does not work correctly. I think it's because of the version of python or opencv. If someone could tell me in which verisons it works I would be grateful.

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.