Can a Rubik's Cube be brute-forced?
stylewarning.com
stylewarning.com
I used it daily for many, many years, but it was inherently infuriating and shameful, as are all gifts from my mother. The Cube design it carried was permanently jumbled. There were stickers all over it, in standard Cube colors, representing its jumbled state, and of course, since it was a clock and not configurable, there was no way to match the colors and "solve" it.
I was forced, every day, to stare at a permanently unsolved, unsolvable Cube, after I had mastered it so many years ago, algorithmically, and I was able to solve a standard Cube in 63 seconds, but I could do nothing about this infernal clock.
Well, I wasn't forced. Sure, I could just stop using it. I could purchase another clock that wasn't shameful. But you know how mother-son relationships can be. Anyway, I finally destroyed it with great satisfaction, and the Unsolvable Cube troubles me no more.
Regarding your questioning of why I smashed the clock, it was not merely because I couldn't "solve" it that I smashed it.
I never checked that closely. It is apparently still available (see link above) so you may be able to find enough images to piece it together.
However, two areas lack color: the display, which is 3 horizontal tiles in the center of the "front" face, and the bottom, where the battery compartment opens, which is unpainted black plastic.
So no, even if you could move the stickers around, there aren't enough for coverage, and why would you cover the display face? I mean, do you want a Rubik's Cube or an alarm clock in this bargain?
This actually looks quite nice. And using the top layer as a knob is a cool idea.
https://www.coolthings.com/cube-clock-is-a-rubiks-cube-that-...
That was my first reaction.
Second reaction to this was "Nah, this is brute-forcing like running through all permutations that's not possible I'm not worthy."
My third reaction was https://xkcd.com/538/
Take a solved cube and twist a corner. Now jumble the cube and try to solve.
Do you see the problem Now?
i.e. changing stickers is "more powerful" than twisting corners.
If you alter the sequence of colours, you alter the finished pattern.
Therefore rendering the cube unsolvable.
QED
Anyway, I think you're agreeing with the person you're responding to; they're suggesting it's more fun to peel and re-stick stickers precisely because that's a way to achieve states that even mechanical disassembly can't solve.
If you really want to make it physically impossible to solve and frustrating, swap two stickers between two cubes so they both have the wrong number of two colors, especially annoying with two colors on different faces of the same piece.
(If you're a Jordan Peterson fan, you probably don't need it for sex with real people, anyway.)
"The algorithmic trick that solves Rubik’s Cubes and breaks ciphers" (2022) https://youtu.be/wL3uWO-KLUE :
> Instead of 10^20 moves to find connecting path(s) towards Solved in a Rubik's cube, this algorithm solves in 2*10^10 from each side (and IIUC the solution side (1*10^10) can be cached?)
The manim code for the video and the c++ solution code are open source: https://github.com/polylog-cs/rubiks-cube-video/blob/main/co...
What's neat about the method in the post is that it requires O(N^0.5) time and O(N^0.25) memory, which allows running it on an entry-level consumer laptop (hours of time and a few GiB of memory) when implemented even in a dynamically typed, garbage-collected language.
And terabyte class databases can be extremely fast if running on SSD.
Plus, you can always just bite the bullet and do it all out of swap - might not be as bad as you fear, and often can optimize whatever you're doing to be more online. There are countless tricks left over from the old days for doing out-of-core operations efficiently, whether disk or tape.
The issue is that many people fail to pay close attention, and that's where the money can really rack up.
I remember something like fifteen years ago we needed a 128GB computer to solve IC modelling (timing closure) problems. While this was reasonably available, the only supplier we could find was gaming-oriented, so we had a blinky light tower PC in the corner of the server cupboard.
Anyway, never underestimate the power of a single computer, especially with a GPU.
I love the simplicity of using lexicographic sorting to solve a problem -- even sorting things like ISO-8601 date strings is delightful to me :-)
This is also the basis for "rainbow tables" for breaking password hashes.
What's an example of a state space that lacks a lexicographically sortable representation?
Edit: in fact, "lexicographic" is an irrelevant detail in the blog post. It's just mentioned as a convenient way to define an ordering on the states. The sqrt(n) speedup is from having any ordering at all. As the article notes, mergesort relies on the same feature.
You can see that in the example in the end, a random cube resulted in a 20 move solution, which is the upper bound for any solution [0]. There are not many cube configurations that require such a long solution and the chance that we hit one randomly (and solved it that quickly) is incredibly small.
In order to make this algorithm optimal, you'd need to do iterative deepening, trying to find solutions of length 1, 2, etc. up until 20.
What I really appreciate about this article though is the solid presentation of math connected with computer science and the author throwing around multiple programming languages. They don't even see the code anymore...
The move set L, or more precisely
L := C^5 U C^4 U C^3 U C^2 U C^1 U C^0,
contains all non-redundant moves sequences of length between 0 and 5. L has 621,649 elements. See e.g. the function that produces this [1].Solutions thus are found between 0 moves and 20 moves inclusive.
If you ask the algorithm to solve a cube with the front face turned, it will immediately output the four words:
"", "", "", "F".
It will also return every other quadruplet of non-redundant moves that achieve the same state if you keep the solver running, for example: "", "F'", "F", "F"
(Here, "non-redundant" means there are no obvious simplifications within each word.)The algorithm is guaranteed to enumerate all non-redundant solutions of bounded length, which includes all optimal solutions, in the same worst-case running time of O(N^0.5) and memory complexity of O(N^0.25). The Common Lisp implementation does return on the first match, but that's an implementation detail, not a limitation of the algorithm.
Lastly, solutions whose length is short typically show up first, since the words "" * "" correspond to the identity permutation, the lexicographically least permutation, and hence the first permutation found in the search.
[1] https://github.com/stylewarning/cl-permutation/blob/master/s...
That Shamir's algorithm is correct was never in question.
My research is on the more general form of this problem (the moves of a rubix cube form a group, can we get from one place to another using a group?). There are good algorithms for doing this, and other computational group theory problems, but they are very complicated. Also, they don’t give you the best answer, just any answer. I’ve been considering writing about them, but it would probably be a fair chunk of a book!
EDIT; after further thought, my stuff is less applicable, because every cube of a rubix cube is unique, while my personal study is in moving things around where some values are the same — while it is true that you can view a side as “9 indistguishable yellow squares”, they aren’t really, as the cubes they are on can each be uniquely identified by their coloured sides :)
https://www.iflscience.com/the-full-1lll-a-rubiks-cube-holy-...
https://www.reddit.com/r/Cubers/comments/whuhkq/i_learned_fu...
I kinda thought that's what speedcubers were doing this whole time.
1 look last layer means that after the first two layers are solved, you would know an algorithm to apply to solve the cube based on the state of the last layer.
With the typical speed solving method (CFOP), the last layer requires 2 "looks" (one for orientation of the last layer, one for the permutation)
1. It has an application to the discipline of waiting. This is easily it's most powerful application.
2. It has applications to group theory, and having a good intuitive understanding of rubik's cubes really does help with some groups and permutations. It also imparts some other small amount of math-related intuition.
3. It has applications in being able to connect with other cubers, which can every once in a while open doors. It's rare, but sometimes you'll meet someone, and cubing will be a part of how you connect, resulting to a good social outcome. It has applications, in that way, to the discipline of socializing
4. It has applications in being able to appear smart to some small subset of people (akin to wearing glasses, reading a book, and other small signifiers). "Appearing smart" is usually not a very useful discipline, but at times it is.
5. It has significant applications to the art of getting bullied.
6. It can greatly benefit one in their discipline of "being annoying". Cube loudly for greatest effect.
G = <g_1, ..., g_k>
we seek to represent an element s in G as a short word over the generating set. That is, we want to write s = g_a * g_b * g_c * ...
for some (a, b, c, ...) we must discover.In Rubik's Cube speak, that's taking a scramble and finding a short sequence of moves that solves (or equally, reconstructs) that scramble.
A lot of problems can be framed as problems in finite group theory, especially in quantum physics and quantum information theory. For instance, to characterize the performance of a quantum computer, we might run a routine that executes a long sequence of so-called unitary operations from a special group called the Clifford group. But in order to run the characterization routine, we must be able to express their product of the sequence as a short word of generators—a problem identical to the Rubik's Cube solving problem.
So the Rubik's Cube gives us tremendous insight into what kinds of methods may or may not work in practice, since it's a non-trivial group that's large but tractable, abstract but realizable as a plastic toy.
That's all for exploring solutions mathematically and/or computationally. As for learning to solve a Rubik's Cube by hand? Not sure it's practical for very much, but it is pretty cool.
Anyways, since it seems you misunderstood the article slightly - the 2010 brute-forcing was done with the help of a datacenter. The new guy estimates his method would take ~2 months on a single machine, maybe less, maybe more - it's a post, not a peer-reviewed paper.
Purely in principle, it shouldn’t be hard to solve a Rubik’s Cube with a computer, right?
Our program would have three parts:
1. A model of the Rubik’s Cube, that is, some data structure that represents a cube state.
2. Some functions which can simulate turns of each side.
3. A solving procedure which takes a scrambled cube, tries every possible turn sequence, and stops when solved.
It is more efficient to travel along the Hamilton circuit and visit each state of the cube. When you reach the solved state you stop traveling.https://en.m.wikipedia.org/wiki/Direct_multiple_shooting_met...
It takes the same amount of time every time and it doesn't actually feel like I'm solving it but instead putting it back to its original state.
It looks hard at first, but once you learn it, it's not too bad.
function solve(p):
return (1, 2, ..., 47, 48)Evolution by natural selection is literally just biochemistry brute forcing survival.
I’d take it apart and put it back together in reset state.
Now that’s brute force.
The same can be said for the monkeys on the typewriters producing Shakespeare. Right?