You are browsing as a guest. Sign up (or log in) to start making projects!

Rubik's Cube Algorithm Finder

  • 5 Devlogs
  • 15 Total hours

A Python program to find optimal* algorithms for moving certain pieces around.

Open comments for this post

34m 27s logged

My program found solutions that I’ve never seen before :)
*
I told it to find an algorithm that takes an F2L pair out (e.g., R U R’ U’). If you are not familiar with the Rubik’s cube, I told it to find a sequence of moves that would result in a certain state.
*
I knew about one, very common sequence (R U R’ U’) and it found 17 others that I had never seen before, in about a minute of search time.
*
Now all that’s left is to optimize it so it can find longer algorithms!

My program found solutions that I’ve never seen before :)
*
I told it to find an algorithm that takes an F2L pair out (e.g., R U R’ U’). If you are not familiar with the Rubik’s cube, I told it to find a sequence of moves that would result in a certain state.
*
I knew about one, very common sequence (R U R’ U’) and it found 17 others that I had never seen before, in about a minute of search time.
*
Now all that’s left is to optimize it so it can find longer algorithms!

Replying to @pi

0
1
Open comments for this post

3h 25m 26s logged

This was meant to be a quick side project. I have now spent more time on this than my main project. What happened??

This was meant to be a quick side project. I have now spent more time on this than my main project. What happened??

Replying to @pi

0
1
Open comments for this post

4h 29m 48s logged

Successfully searched up to depth 6 (meet-in-the-middle, so essentially up to 12) and solved a 10 move scramble in 50 seconds!
*
This program solved a rubik’s cube that had been scrambled with “F R U’ B’ D’ R’ L F’ B U’”, so ten moves. It correctly found the optimal 10 move solution, as well as many others.
*
This is Python, and I’m already running 18 searches in parallel, so I’m not sure if I’ll be able to improve the raw speed, but I hope to prune more and maybe even do a heuristic-based search in the future.
*
I’m planning on doing some more with this that may involve loosening the constraints. That may or may not speed it up.

Successfully searched up to depth 6 (meet-in-the-middle, so essentially up to 12) and solved a 10 move scramble in 50 seconds!
*
This program solved a rubik’s cube that had been scrambled with “F R U’ B’ D’ R’ L F’ B U’”, so ten moves. It correctly found the optimal 10 move solution, as well as many others.
*
This is Python, and I’m already running 18 searches in parallel, so I’m not sure if I’ll be able to improve the raw speed, but I hope to prune more and maybe even do a heuristic-based search in the future.
*
I’m planning on doing some more with this that may involve loosening the constraints. That may or may not speed it up.

Replying to @pi

0
1
Open comments for this post

2h 40m 33s logged

Well I thought this would be a quick project. 2.5 hours of programming later: It was not.
*
Since the last devlog, I have a Rubik’s Cube represented correctly in the code now, and it can make moves.
All I have left to do for this part of the project is to fix the str method that returns a visualization of the cube. Right now, it gets the orientation mixed up on up and down quarter turns, but it shouldn’t be too much debugging…
*
Here’s a screenshot of it working next to it not working:

Well I thought this would be a quick project. 2.5 hours of programming later: It was not.
*
Since the last devlog, I have a Rubik’s Cube represented correctly in the code now, and it can make moves.
All I have left to do for this part of the project is to fix the str method that returns a visualization of the cube. Right now, it gets the orientation mixed up on up and down quarter turns, but it shouldn’t be too much debugging…
*
Here’s a screenshot of it working next to it not working:

Replying to @pi

0
1
Open comments for this post

3h 40m 35s logged

This project is very difficult to debug! It’s just a big lookup table that I entered in by hand… I’m sure I made many typos, so that will be fun.

This project is very difficult to debug! It’s just a big lookup table that I entered in by hand… I’m sure I made many typos, so that will be fun.

Replying to @pi

0
1

Followers

Loading…