I've been fascinated by the Rubik's cube for years after learning to solve one in 7th grade. I started to get back into it high school and dropped my solve times down below a minute. Then I continued in college and got down to 25 seconds average with a personal best of 15.15.<p>I created a 2x2 Rubik's cube in Java as my freshman final project for my second computer science class, but it was quite ugly.<p>Recently, I decided to take another look at implementing the cube - this time using Python. I also wanted a way to generate cubes and check if they were valid. The main representation of the cube is as a permutation group - a 48-tuple where each element in the tuple is unique. The solved cube is represented as (0, 1, ... , 46, 47).<p>Turns of the cube simply permute this tuple. To figure these all out I spent a lot of time with a cube covered in post it notes.<p>All of the stuff I implemented in the checking for valid cube comes from this stackoverflow post: <a href="https://math.stackexchange.com/questions/127577/how-to-tell-if-a-rubiks-cube-is-solvable/127627" rel="nofollow">https://math.stackexchange.com/questions/127577/how-to-tell-...</a><p>I've had a lot of fun working with this cube as my personal project. I recently created a Django website and a RESTful API to display randomly generated cubes. Soon I'll be working on a data pipeline to process these random cubes and display them nicely.<p>I've looked into working on a solution algorithm to implement Thistlethwaite's algorithm - <a href="https://www.jaapsch.net/puzzles/thistle.htm" rel="nofollow">https://www.jaapsch.net/puzzles/thistle.htm</a>. I think this will take me a while, but it should be doable. I haven't really though too much about implementing it, but I think the way to do it is to define what it is for each step to be completed and then BFS a graph of moves to end up in that state. If anyone has looked into this I'd love some advice!<p>You can find the code I've written on Github: <a href="https://github.com/elliotmartin/RubikLite/blob/master/Rubik.py" rel="nofollow">https://github.com/elliotmartin/RubikLite/blob/master/Rubik....</a>