
With zero logic at all behind finding actual legal states, this program went merrily on its way for two days straight, generating nearly a terabyte of garbage before I got sick of moving files out of the way and cut it short. I kind of expected to have to leave this running for a couple of hours, or maybe overnight at best. While(std::next_permutation(stickers,stickers+24))
Runix cube 2by2 code#
Here’s the code for my excessive 2×2 generator:Ĭhar stickers = "WWWWGGGGRRRRBBBBOOOOYYYY" My very first idea was just to take that cube state string – “C++ provides an in-built library for doing combinations and permutations, and it didn’t take long to find a helpful example on Stack Overflow that would do what I wanted. Call it the Rubik’s Storage Problem, if you will.)
Runix cube 2by2 free#
The infrastructure nerds among you can feel free to discuss how they’d go about implementing such a project. To try and put that into a human perspective, Seagate, Toshiba and Hitachi together manufactured about 0.9Zb of storage in 2015 – to store this much data, we’re talking about acquiring two and a half years of the entire world’s production of hard drives in order to do so. You’d be able to bring it down a fair way with compression, but data redundancy, availability requirements, which continent you’re going to build this data centre on and which nations you’ll be negotiating with for power will also affect the final details. If you multiply that number by 55 bytes – 54 to store each sequence of letters representing each individual state, and another byte thrown in for handy line breaks – you’re looking at over two zettabytes of data. A 3x3x3 has a total of 54 stickers, nine to a face, and a little over 43 quintillion unique, legal states – that’s 43 thousand thousand thousand thousand thousand thousand permutations. (The same can not be said about a regular Rubik’s Cube. The state of a 2×2 cube can be represented by a string of 24 letters representing the colours on each face of the cube, such as “This surprised me a bit – the entire catalogue of possible states for a pocket cube to be in would fit on even the cheapest USB flash drives available today.
Runix cube 2by2 full#
I wanted to try to generate a full list of every ‘legal’ state of a 2×2 – only states you can get to by turning the puzzle in the usual way, no disassembly or twisting corners) – and turned to programming for a solution. Despite this, it is only ever eleven moves away from being completely solved (this is God’s number for the 2×2 a 3×3 Rubik’s can always be solved in no more than 20 moves). There are 3,674,160 possible states (including solved, and the rather fetching striped pattern in the photo above).

Each of the eight corners has three different colours and the cube can be mixed up or scrambled by rotating the faces 90 or 180 degrees each turn. I’m not much of a speedcuber (the current world record for solving a 2×2 is 0.49 seconds), but I love the idea of a Rubik’s cube as a sort of state machine, and wanted to explore the mathematics of it a little bit.Ī pocket cube has 24 stickers, four of each of the now-standard Rubik’s colours – white, yellow, green, blue, orange, and red. I’ve recently taught myself to solve it using Ryan Goessl’s excellent 2×2 beginner’s guide, and am down to about 25 seconds each solve. It’s a much simpler puzzle than the full 3×3, and a really high-quality speedcube like this MoYu WeiPo can be had for not a lot of dollars. The Pocket Cube is a 2x2x2 version of the Rubik’s Cube. (What’s this got to do with Arduino? Why bother doing any of this at all? Stay tuned for a future project!)
