\

Show HN: Scroll through all 43252003274489856000 Rubik's Cube states

163 points - yesterday at 11:16 PM

Source
  • noduerme

    today at 5:43 AM

    I wrote a 3d rubiks cube slot machine for my old online casino. It scrambled the cube randomly 4 times and gave the player 60 seconds to solve it by twisting up to 3 times. Lots of weird quaternion math to handle the spinning and shift key twisting at the same time. All with simple geometry in Away3D / AS3.

    The real hard part of designing that game was creating the payout structure. The game paid an equal amount for each "line" of 3 colors in a row on any face after the player made their third move. There was a progressive take and jackpot for a perfect solution. And I specifically wanted to target a zero house edge for the game, to reward the best problem solvers. So the question was, given 4 random twists off a perfect cube, what are the individual chances of getting 64, 63, 62...1 lines of sequential color given the best 3 spins from the initial random state, and then hiw to allocate the payout structure accordingly.

    Probably a billion monte carlo runs and I had a pay table. It was lots of fun. I wish more gambling games rewarded skill that way.

      • divbzero

        today at 6:19 AM

        Casino games are rarely zero house edge. Is there a way you signaled this feature to problem solvers? Did the game prove to be successful?

    • zetanor

      today at 2:40 AM

      Sweet, can I mint these as NFTs? I don't know how to multiply 43252003274489856000 by 50 USD but I think it could make me a lot of money, and I like money.

        • HPsquared

          today at 6:41 AM

          That's more money than there is in the universe, I think you're onto a winner here!

            • hahahaa

              today at 6:57 AM

              You only need to sell one at $50, then market cap does the rest and you are boundlessly rich.

              • sail0rm00n

                today at 6:55 AM

                If we can capture even 1% of the market…

            • thih9

              today at 6:54 AM

              In case someone is curious, NFTs were tradeable tokens popular for a short while in the early 2020s.

              > Initially pitched in 2017 as a new class of investment asset, NFT trading increased from US$82 million in 2020 to US$17 billion in 2021. Its market was occasionally compared to an economic bubble or a Ponzi scheme. In 2022, the NFT market collapsed; a May 2022 estimate was that the number of sales was down over 90% compared to 2021. By September 2023 one report claimed that over 95% of NFT collections had zero monetary value.

              https://en.wikipedia.org/wiki/Non-fungible_token

              /s

          • jcims

            today at 1:14 AM

            My scroll wheel covers about 12 states per inch of travel. Did the stubby pencil work and it would take about 9.5 years to scroll through them all if the wheel surface was moving at the speed of light.

          • snowwrestler

            today at 2:47 AM

            Reminds me of a book I recently read:

            https://en.wikipedia.org/wiki/A_Short_Stay_in_Hell

            The numbers produced by permutations are astounding! Especially compared to the (much smaller) numbers in our actual physical universe.

              • somenameforme

                today at 5:32 AM

                My favorite one is chess games. If you managed to compress each chess game down to just a single atom, the physical size of a disk to save this data would exceed the amount of atoms in the universe. Even the number of theoretic positions (ignoring legality/possibility) is just below the number of atoms in the universe.

                Though it must be said that once one starts looking at permutations of things, the number of atoms in the universe seems quite small indeed. 10^80? What's that, like 7 or 8?

                  • notpushkin

                    today at 7:09 AM

                    The number of permutations of n distinct objects is n!. So, probably a bit more than 8, since 8! < 10⁸, but I don’t think you are terribly off :-)

            • m4tthumphrey

              today at 6:58 AM

              This is very satisfying to play with, top work!

              • Waterluvian

                today at 12:42 AM

                Ah nice, it has some of my favourites!

                  • r4ndomname

                    today at 12:50 AM

                    I am very curious about your other favorites it does but have.

                      • Waterluvian

                        today at 1:09 AM

                        My kids had a science battle in the basement last summer, which resulted in both their Rubik’s Cubes colliding mid air. They both exploded (the cubes, not the kids) and were reassembled at a ā€œfix this before mom finds usā€ rush speed.

                        I think my favourite is this pattern my 9 year old makes on ā€œGreenyā€ (that’s his pet name for the cube that now has 11 green squares) where all four top corners are red/white/blue.

                          • bambax

                            today at 5:50 AM

                            When I was a kid (many, many moons ago) I found a solved Rubik's Cube in a house where we were staying. I played with it and soon enough couldn't put it back in its solved state.

                            So I took it apart and rebuilt it 'properly', which didn't take long and wasn't too hard. I wonder how many people did the same.

                            • tgv

                              today at 5:34 AM

                              This here is the difference between theory and practice. Our minds are to feeble to understand reality.

                  • PaulHoule

                    today at 1:04 AM

                    Reminds me of that time when, as an undergraduate, my "team" entered a Problem Solving Competition and couldn't choose one of the two problems so we did both in parallel.

                    One of us wrote a program in BASIC on a Tandy 1000 that the rest of us estimated would take more than a google years to finish, but he wasn't be dissuaded and let it run the whole weekend.

                    I made an analysis that was mostly correct but was off by a factor of four because I mistook a radius for a diameter.

                    • sensecall

                      today at 5:12 AM

                      Wouldn't it be cool to click and then see the quickest solution and it rotates in front of you, or a sequence of moves to solve.

                      • kazinator

                        today at 4:52 AM

                        OK. So I put the slider into a random middle location. Then I zipped it back all the way left as fast as I could. Still not up to competitive speed cubing level! Shucks, golly, gee.

                        • nzealand

                          today at 2:35 AM

                          It took Ernő Rubik four years to develop the cube.

                          He immediately scrambled it, then spent the next month figuring out if it could be solved.

                          Luckily no one told him there were 43 quintillion valid combinations.

                            • avandekleut

                              today at 2:44 AM

                              Solved theoretically? I figure you could at least intuit that reversing all the moves in the scramble in reverse order would solve it.

                                • zamadatix

                                  today at 3:36 AM

                                  The above makes everything sound very intentionally done towards the end result. He came about making the cube for finding ways to tackle the engineering challenge of building a device which moves in such levels if freedom, ended up scrambling it, and then spent a month figuring out how to treat the scrambled state as a puzzle to be solved. Messing with it gave him insight into just how complex a puzzle it was and the rest goes from there.

                          • netvarun

                            today at 12:54 AM

                            Wow, this was really fun to play around with! Amazing execution and launch!

                            Quick feedback: it’d be great if the page updated when the URL changes, so you can explore different positions without reloading.

                            Right now, if I change the URL/hash of the cube position (eg: incrementing by 1 https://everycube.alen.is/?view=3d#5319001606686939024 ), the app doesn’t update and I have to open the new URL in a separate tab to see the new position. [Chrome 150 on Mac OS X 10.15.7]

                              • Alen123

                                today at 1:41 AM

                                just shipped a fix, the app now listens for hash/URL changes and updates the view without needing a reload. thanks for catching this!

                            • cr125rider

                              today at 12:35 AM

                              I love this. Excellent weird internet thing.

                              • ajkjk

                                today at 5:27 AM

                                well that's just like, your coordinate system, man

                                • richstokes

                                  today at 2:40 AM

                                  First thought; this could be turned into a really cool password generator

                                  • idorube

                                    today at 5:53 AM

                                    But, why?

                                    • jordanarseno

                                      today at 3:06 AM

                                      structure emerges from chaos at 23,738,673,083,197,685,761 & 34,677,398,788,068,093,945

                                        • bambax

                                          today at 5:52 AM

                                          True! How did you spot this though? Did you look at every possible position?!?

                                      • pestatije

                                        today at 6:11 AM

                                        this does permutations of pieces position and orientation

                                        would be cool permutations of moves instead...the visuals would be especially interesting to have as a raw Rubik's simulator

                                        • skcurf

                                          today at 4:26 AM

                                          Cool!

                                          • donkeylazy456

                                            today at 1:24 AM

                                            literally doom scrolling

                                              • Alen123

                                                today at 1:42 AM

                                                haha healthiest possible doom scroll though

                                            • purplemoonx

                                              today at 2:54 AM

                                              How did the kid who could solve the Rubik's Cube in under 1 min not become an algorithm designer - some genius backend dev?

                                              I blame guitars.

                                              All these kids got bad ass at playing Wonderwall, PHP was just slightly less cool than playing Wonderwall. So for 2-4 years they were sidetracked.

                                              Playing Wonderwall at parties.

                                              But if they had went straight from solving Rubik's Cube in 1 min to O(1) time complexity in a REST endpoint like peak 2-way communications (WebSocket, GRPC) these fuckers would be optimizing LLM embeddings at this point.

                                              Karpathy? No, I want Steve from the Chess club who could recite any J.R.R. Tolkien writing, who has a Runescape character worth $4 million. Fuck LeCunn. Where's Steve?!

                                              STEVE! I'm sorry I laughed at your Pokemon collection. I'm sorry Steve! I'm fucking sorry! PLEASE COME BACK

                                                • opan

                                                  today at 3:23 AM

                                                  >How did the kid who could solve the Rubik's Cube in under 1 min not become an algorithm designer - some genius backend dev?

                                                  Somebody else figured out the algs. The speedcubers just rote memorize them and then practice becomes mostly about execution. (Oversimplifying a little, but I have gotten sub-60 myself with the Roux method a few years ago)

                                                  Interestingly I've never managed to pick up programming but learned the cube pretty well (as an adult), and my programmer friend can't seem to figure out the cube at all even with me giving him extra help on top of linking materials I learned from. I suspect it's a very different skillset and we're both weak in one area.

                                                    • purplemoonx

                                                      today at 3:42 AM

                                                      Yeah goes to show why Leetcode is such a problem for so many very good developers.

                                                      It's a different kind of thinking.

                                                      That said, if that "clicked" for you, you may find yourself surprisingly good at backend - algorithmic thinking shines in crypto, search, and LLMs. Get into Python or Node if you haven't for some random idea (ever wanted to make a web contact form or something?) - the LLMs will set you up for success. If you figured out Rubik's Cube, you will 1000% get it because I know you have the patience and learning ability.

                                                      ----

                                                      There is one algorithm I saw recently on Youtube, the bro pops one of the little cubes off and "cheats" by turning it around manually.

                                                      I consider this to be "freestyling" with the Rubik's Cube. Wtf is that all about?

                                                  • eurleif

                                                    today at 3:04 AM

                                                    With all due respect to Steve, under 1 minute isn't that impressive. You can get there just by doing the beginner's method (a handful of different move-sequences) rapidly. The people who really study Rubik's Cube algorithms in depth can do it in a few seconds.

                                                      • purplemoonx

                                                        today at 3:26 AM

                                                        Hahah what are you doing here???

                                                        I had a friend - David - he could do it insanely quick. He's basically who I am thinking of in my post since he was also a genius at guitar, and could play beautifully. And he taught me basic PHP.

                                                        We spent a lot of time on your site on random Friday nights (him playing guitar) hahah, good times.

                                                        More of a yo-yo guy myself. I could walk the dog, pendulum, what-have-you. Around the world if I'm feeling saucy

                                                        Also: Gross, wtf happened to it???? If you can't say publicly, just blink 3 times

                                                        • tonyedgecombe

                                                          today at 5:28 AM

                                                          I remember a TV program showing someone breaking the one minute record for the first time. I could already do it at that point, I'm sure many others could as well.

                                                            • purplemoonx

                                                              today at 6:22 AM

                                                              I'm starting to realize I'm the only one who couldn't.

                                                              I think that's why I failed that Leetcode that one time - it was never in the cards

                                                      • today at 5:02 AM

                                                    • skcurf

                                                      today at 4:26 AM

                                                      cool!

                                                      • tkocmathla

                                                        today at 5:49 AM

                                                        It would be really funny, and sociopathic, if every state change registered as a browser history entry so I had to click Back 50,000 times to get back to Hacker News.

                                                          • russum

                                                            today at 7:01 AM

                                                            Oh wow, you don’t do ā€œOpen in New Tabā€ when reading HN? Thanks for the idea, I should really try that, maybe it will help with my infinite open tabs problem.

                                                        • maxlin

                                                          today at 5:52 AM

                                                          I think you missed at least a few, can you re-check through them?

                                                          • Aoi_Asahina

                                                            today at 6:25 AM

                                                            [dead]

                                                            • lee337

                                                              today at 6:10 AM

                                                              [flagged]

                                                              • Mathsystem

                                                                today at 3:14 AM

                                                                [flagged]

                                                                • jocelyner

                                                                  today at 3:43 AM

                                                                  [dead]

                                                                  • venera22

                                                                    today at 1:45 AM

                                                                    [dead]

                                                                    • khazhoux

                                                                      today at 1:48 AM

                                                                      At some point though, how many states is too many?

                                                                      We have massive housing affordability and employment shortage problems, meanwhile here’s a tech elite flouting 4x10^9 states which he doesn’t pay taxes on and most of them will not even get used. Is that really fair?

                                                                        • DerekL

                                                                          today at 2:14 AM

                                                                          It's actually about 4x10^19 (exponent 19, not 9).

                                                                            • msl

                                                                              today at 6:23 AM

                                                                              Imagine being so well off that you don't even notice being off by ten orders of magnitude. Meanwhile, there are people dealing with negative exponents.

                                                                              • khazhoux

                                                                                today at 4:01 AM

                                                                                Typo, but this just shows the extreme inequity when one cube amasses so many states.

                                                                        • cuoder

                                                                          today at 2:22 AM

                                                                          Non-AI posts be like