Hacker News new | past | comments | ask | show | jobs | submit login
2048 in 4D (huonw.github.io)
274 points by dbaupp on Mar 17, 2014 | hide | past | web | favorite | 113 comments



Of all the spin offs that have been posted here this one is my favorite. Very little of the original strategy carries over, it's almost an entirely new puzzle.

Very creative, well done!


"Hoo dee doo"

"4D 2048? Well, I beat regular 2048 and I'm only like 97% totally addicted to that. I'll try 4D out for a few minutes"

hours pass

twitch... twitch


Can someone make an MMO 2048 that flies a flappy bird every time you combine two numbers!?


Have it jump the bird every time two numbers are combined. The strength of the jump is determined by the magnitude of the resulting number.

Addendum: the shear force of combining two 1024's into a 2048 would send the bird straight into orbit, at which point the game would transition into Flappy Space Program (http://corpsmoderne.itch.io/flappy-space-program)


And to win you need 5 birds in orbit.


Look for new forks of 2048. $20 says someone's working on this now.


...I'm gonna try anyway!


It would be neat to create two games that appear to be different, but designed in such a way that the winning user input is the same for both games. A simple and obvious example would be an infinite runner game where the winning input is a certain rhythm of spacebar presses, and a musical rhythm game that requires the same rhythm of spacebar presses. But I'm sure it could be done with much more complex games.


Here's a tool assisted speedrun of a gamer playing Mega Man 3, 4, 5 & 6 all with the same button inputs. http://www.youtube.com/watch?v=z5pz6waED0w It's kind of chaotic, and not quite what you described, but similar and still pretty impressive.


Tangent: I briefly worked in the "gaming" (gambling) industry. To cope with the proliferation of laws, the backing algorithms could be changed to match whatever games of chance which were legal in a given jurisdiction, then topologically transformed to look like the desired game. What looked like video poker might actually be bingo, hence legal in a "only bingo is legal" locale.

(ETA: Sorry, no how-to details. I didn't work on that part of the code.)


That's pretty wacky. Could you explain a bit more about how the transformation works? I can't quite see how you run bingo behind the scenes but display something that looks like poker. They seem too different.


The general concept is that the game isn't skill-based anyway; you have a randomly generated X that will have a payout of Y. If you have generated a bingo card + a ball sequence that will lose, then you can map that as a video poker hand that will lose and display that to the customer; if you have generated a bingo card+ball seqence that will win a multiple of 10, then you show that to the customer as a video poker hand that has, say, a full house combination and write in the 'rules' that having a full house hand will pay out a multiple of 10. Sure, it's not proper poker; but it's poker-themed enough to be attractive and such games are manufactured.

You just construct an artificial mapping between losing and winning positions in both games, the rest is cosmetics. You can have an "opponent hand" that is revealed afterwards or deal out "your hand" to you as in hold-em poker - it doesn't mean that the cards need to be "dealt" fairly; they are just illustration for a pregenerated loss/win/bigwin decision.


See adjacent reply.


Thanks much for the reply and for letting me know about it! Fun stuff.


The most bizarre part, to me, is that the law actually cared about the real probability distribution over winning conditions, instead of the surface appearance. That seems way too sensible for lawyers to have come up with.


Law is often written by people who don't understand something well enough to regulate it sensibly, they just draw some lines in ignorance and then are surprised when the knowing find creative ways around it.

"No gambling here. Bingo only, because little old ladies will vote against us in droves if we ban it too." "Ok, can we do a video bingo game?" "Sure. It's bingo." "Can we line up five bingo cards at once?" "Sure. It's bingo." "Can we add up corresponding cells and display those?" "Uh...sure. It's bingo...ish." "Can we display just the first line of that summation grid?" "Yea....ah. It's still...uh...bingo." "Numbers are just arbitrary-shape symbols; can we display whatever icons we want in place of those numbers?" "Uh...yeah...kinda odd, but don't see why not." "OK, here's our game. Take a look." "Hey! That's poker! That's illegal!" "No, it's bingo. It just looks like poker after every step YOU approved."


Start with the numbers 1, 2, 3, 4, 5, 6, 7, 8, and 9. You and an opponent taking turns picking numbers, each time a number that has not been picked before. The winner is the first person to have picked three numbers that sum to exactly 15.

Try it out with a friend. You will gradually realize that it it seems surprisingly familiar...


  8 3 4 
  1 5 9 
  6 7 2


I bet I can force a tie no matter what. :)


> A simple and obvious example would be an infinite runner game where the winning input is a certain rhythm of spacebar presses, and a musical rhythm game that requires the same rhythm of spacebar presses.

Sounds like BIT.TRIP Runner.


The only game that comes close to that, that I'm familiar with is Henry Hatsworth in the Puzzling Adventure for Nintendo DS. It combines a platformer with a bejeweled-style puzzle on the bottom screen, where the tiles that spawn are tied to what enemies you kill and how much damage you take, and you need to play both games to damage enemies, get bonuses and summon the giant victorian steam/tea-powered robot. Thankfully the top game is paused while you swap tiles on the bottom.

It's awesome, highly recommend.


Make it 3-d print bitcoins from Raspberry Pi and I'm there :)


built with node.js


Or go. Or haskell.


Poor Ruby.


DHH would probably ping-pong some code on this!


by a 12 year old.


Bought the next day by Yahoo! for 34 billion


who dreams in code and speaks with a Lisp.


But who actually just licensed the code from someone else.


in pure CSS.


Reminds me of the old breakout games that also required you to balance the paddle while moving back and forth. I can't find any of the ones I remember, but this one is similar: http://www.retrosabotage.com/breakout/balance.html


I'm glad I wasn't the only one to think of that...

https://news.ycombinator.com/item?id=7407510

Alternatively, to move a given tile you have to flap a bird through a number of pipes equal to its value (or maybe a little more sanely, its logarithm.)


It's so hard to get intuitions about higher dimensions and this seems to do an incredible job. The game is simple enough and the cardinality of the dimensions low enough (2x2x2x2) that I can actually play it smoothly (having played the original and with a bit of practice at the 4D version).

Does that mean I've formed 4D intuition? I think this just happens to be in a class of 4D mechanics that's isomorphic to 2D variants, so the answer would be no. If so, how many such 2D variants are there?

For those interested, 4d rubick's cube:

http://www.superliminal.com/cube/cube.htm


Any discrete set of points can be losslessly represented in any positive number of dimensions. The 4d version has 16 spaces, so you could just have them all in a line for a 1d representation of the same game. There are lots of ways to lay them out in 2d, or 3d, or 4d as well. So I would say that you certainly have developed an intuition for four dimensions! You're not cheating or anything just by rearranging the points into 2d.

(Continuous shapes, like solid hypercubes, are tricker ;)


That makes sense.

I think my intuitions for the discrete and continuous are similar for 2D and 3D. Are they fundamentally similar? How do they differ, even if only a little? It seems that discrete 4D intuition should somehow help with continuous 4D intuition.


It's all about how the points are connected to each other. In 1d obviously you can only have 2 connections per node - one to the left and one to the right. In 2d you have a lot more flexibility. You can curve lines around to make much more connected graphs.

In 2d there are still restrictions though, mainly the "3 utilities problem" https://en.wikipedia.org/wiki/3_utilities_problem But in 3d, you don't have restrictions on connections anymore. You can always weave a new connection around the existing ones.

In a square, each corner is connected to 2 neighbors. In a cube, each corner has 3 connections. In a 4d hypercube, the corners have 4 connections. So to make a "4d" hypercube in 3d, just draw 4 connections between corners :) https://en.wikipedia.org/wiki/File:Hypercube.svg Some supercomputers have nodes connected in a hyper-torus configuration. It doesn't matter how you arrange the nodes physically, they just run cables around to recreate the interconnections that would exist in a 4d torus.

For 4d, it's easy enough to do the corners. Each one has 4 connections - one each for up/down dimension, left/right, forward/back, and... +W/-W direction. You can see this in the game. Each corner can move two directions in its own square, or to two other squares, total of 4 directions. If you want to do more than just corners though, it gets more complex. Think of a 3d cube http://joppi.github.io/2048-3D/?utm_source=hn A piece on the edge can move to two corners, or the center of two faces. Actually, it's easier to think of it as lots of little cubes, stuck together so you only have corners :) A 3x3x3 cube is really 8 2x2x2 cubes that share some nodes. So the block in the very center has lots of options. Up, down, left, right, forward, or backward - 6 options. That's twice as many as the corners! That's because the corners are as far as you can go in one direction, so they can only move back the other way. Pieces in the middle can move either way - exactly twice as many options.

Let's make an even bigger hypercube, 3x3x3x3. That's 64 little 2x2x2x2 cubes stacked in 4d. That's 8 3x3x3 cubes that make up the "faces" of the hypercube, and each cube has 8 2x2x2 smaller cubes in it. But remember most of those nodes are shared by more than one cube/hypercube. So the corners of our hypercube can only move to 4 other spaces. A piece in an edge can move to either corner, or into one of the 3 faces. (Look again if you can't imagine all 3 faces https://en.wikipedia.org/wiki/File:Hypercube.svg) So that's 5 options for a piece on the edge. The middle of a face can move (say) up and down and left and right, as well as into the middle of either cube that it's on. For a space on a face, that image is actually awful. Remember, that outer cube is a whole other cube, it's overlapping all the other cubes in that picture. Try this page http://eusebeia.dyndns.org/4d/8-cell.html Anyway, a piece in the middle of a face can move (say) up, down, left, right, or into the center of either of the two cubes that it's on - one in the forward direction, the other in the +W direction. Try visualizing this for several different faces until your intuition kicks in :) Finally, the piece in the very center can move either direction in each dimension, for a total of 8 directions, exactly twice as many as the corners. It will always end up in the center of a face, because those are the only pieces it's connected to.


> Does that mean I've formed 4D intuition? I think this just happens to be in a class of 4D mechanics that's isomorphic to 2D variants, so the answer would be no.

Yeah, when I first went to the page, I expected the numbers to start changing on their own, but I do like this version very much.


There's a subreddit for these: http://www.reddit.com/r/2048/



I expect to see 2048 in 5 dimensions tomorrow.


As you get into higher dimensions, you get exponentially more space, which makes getting to 2048 easier and easier (3x3x3 3D suffers from this, somewhat). So 5D would probably need to bump the winning score up to 4096 or even higher, but then the game start taking far too long.


this 4d is actually harder since each dimension is 2x2. 7052 :/ still haven't beaten it..


Yes, but the smallest interesting 5d one is 2x2x2x2x2, i.e. 32 squares, which is much more flexible than the 16 squares of the original (and of this one).


So 2048 in 2048 dimensions after that?


Unfortunately, even assuming a board diameter of 2, storing that game's any state would require some 10^435 times more bits than there are cube Planck lengths in the observable universe.


Only naively. Since the user is incapable of inputing that number of bits, it does not require that number of bits to store. In this case, one need not even be that fancy; a fairly naive sparse algorithm would do fine. It would take a user a long time to have enough tiles laid down for the time to calculate the new board state to even be perceptible, and the computer will still be able to compute the next board state faster than a human can comprehend the effects of the previous move.

Your far, far, FAR bigger problem is UI. :) Again, you need not display all dimensions at once, so you can treat it as an n-dimensional problem, but that still calls for some crazy UI pretty quickly.


Undoubtfully the number is really large, but I'm not sure what exactly you mean by cube Planck lengths. A comparison to atoms would be more clear.

Still, it wouldn't have to. Since most arrays would have pieces with lower numbers( 2,4,8 ) you could very efficiently compress the data.

At some point you would run out of memory but it would be playable. Just like those Game of Life implementations with seemingly infinite grid.


Planck length is a theoretical very small unit of length in physics. It is the scale of quantum foam and several orders of magnitude smaller than all those fancy particles like quarks, electrons, protons and atoms: https://en.wikipedia.org/wiki/Orders_of_magnitude_%28length%...

BTW you are right about compressing: you could store the initial state very efficiently, and probably even play the to the end without trouble.


if you store it with log2(n) you could easily store everything with a single byte. That brings the storage requirements down considerably. Though you still have huge issues with storage, not to mention input. For input you'd need 4096 combinations!


You can even do 2 numbers per byte (11 takes 4 bits).


Sorry for the downvote, I mis-clicked. Wish you could change a vote afterward.


Or 2048 in one dimension.


2048 in l^2 Hilbert space.

Still countable. [/troll]



Seems easier than 4D: I played on a 16-square single board as if it were 4D, and the "pulled down" numbers from the other (essentially random) board if they lined up nicely, or if I needed new numbers.



(I'd actually made it before that, but you prompted me to post it here. :) )


It seemed like too short a time. I figured someone had thought of it first, but I still couldn't help saying something. Nice work!


I noticed I'm doing a lot better on this version than 2D 2048, presumably because each tile has more degrees of freedom (2 in the WASD plane, 2 in the arrow-keys plane).


I think you've put your finger on an interesting point, but it's not so easy. Since every tile in the 2x2x2x2 cube is effectively in a corner, it has only 4 valid neighbors. This is the same number of valid neighbors as the 4 interior tiles of the 4x4 game. The other tiles have 3 and 2 valid neighbors.

There's another thing. It can take more moves to put a tile next to another tile in the 2x2x2x2 game because of these degrees of freedom.

It's not clear to me how this shakes out with gameplay, and I've already wasted enough time on the 4x4 game that I'm scared to try the 4D game to find out!


> every tile in the 2x2x2x2 cube is effectively in a corner

Time for the 3x3x3x3 game. The board would look like a Sudoku grid.


Rumour is King is working on "Flappy 2048" - in-app purchases available in case you run out of taps or swipes


Final release name would be Binary Saga. You can pay for spawning specified numbers with 100% probability. You just don't know where they will spawn.


How is this 4 dimensions? It just seems like 4 subdivisions that cuts down the number of inside tile corners.


Isn't time technically 4D?

So you would have to match up this puzzle with one being worked on by someone yesterday.


Isn't time technically 4D?

Anything can technically be the fourth dimension. The thing about dimensions is that they are open to be defined as needed. You can have four spatial dimensions, you can have ten spatial dimensions. You can have ten spatial dimensions and time being an 11th dimension. Its all up to whoever is defining the model being, well, modeled.


No, one is often saying the world i 3D and time makes it 4D. But there is nothing stopping you from having something in 4D where time isn't the fourth dimension.


That's how Einstein defined our world. Actually it's common to see 4 (and more) spatial dimensions in some science fiction novels, including the very famous one called "Three Body Trilogy"("San Ti" in Chinese).


Nothing can kill my productivity like the original could.


this reminds me of tic tac toe ten, where the game is a meta game of itself:

http://mathwithbaddrawings.com/2013/06/16/ultimate-tic-tac-t...


I find using both hands on the keyboard irritating.

If it was possible to double-hit the up/down/left/right arrows (i.e. twice in succession quickly) to move between dimensions, then I could use it with one hand.


AHHHHH MY BRAIN IS FULL OF FOUR DIMENSIONAL CLUSTERFUCK


I use the workman keyboard layout. This was a complete mindfuck until I realised what was happening.


Has it occurred to anybody else that this is the perfect way to explain how to visualize > 3 dimensions? Using the same method for going from 3 to 4 in this game, you can go from 4 to 5, 5 to 6, etc.

Potentially transformable into a really cool learning tool


Much more playable than I expected.

Now someone do one based on taste and smell.


Any synesthesiatics care to chime in here?


This is madness! The decay of western civilization is nigh! All we need is the string theory 11-dimensional version of the game to show up and doom us all!


how do you play with a phone? i can only swipe tiles but I cant change dimension. there need to be some sort of "two finger swipe" for WASD keys.


I couldn't work out how to implement the extra 2 movement dimensions on a phone. Does JS support detecting 2 finger swipes (or something similar) in a sane way?


You can certainly grab the number of touches in an event - two-finger swipe might be interesting. MDN has quite a few examples: https://developer.mozilla.org/en-US/docs/Web/Guide/Events/To...


Very cool, thanks; I've added two-finger swipe for the extra two dimensions.


You may want to check out Hammer.js (http://eightmedia.github.io/hammer.js/)


You could separate the screen. Top half/bottom half.


I can't get passed 260. It's driving me insane!

Any strategies you guys want to share?

edit: wow! Ive only been using half of the keys! 836 booya!


Just got 2340!

For me, its all about looking at all three panels and making moves in the other ones that will not affect the two.

That is, if I have a choice to move up or down an the other 2 panels can only move down, I would choose up. Then I can score another 4, 8, 16 or so points without changing much of the board.


I now want to see 2048 in 2048D.


edit: Looks ok, I'm confused :)

It is interesting. The best way to solve it is to forget about dimensions and just learn the rules of what key does what in terms of piece movement.


You can forget about dimensions... yet it's still in 4 dimensions. That's what's so cool about it!


You can move "up" and "down" along all 4 orthogonal dimensions; what's missing?


In the original 2048 I only used the arrow keys.

In the 3D version I noticed it worked with WASD(QE). The arrow keys still mapped to WASD.

This version separates WASD from the arrow keys, they now control completely different movement dimensions.

I had to read the instructions a few times before it clicked that I had two use WASD and the arrows for two different tasks.


It's not really in 4D. More like: 4 games at once.


not true, since WASD move tiles in the 3rd/4th dimensions (try it out)


Ah, thanks. Hmm... this requires a lot more thought than the original.


i hate this game now


Now, the next challenge is to build a 2048 4D solver.


These games are really not good for my productivity!


Is this winnable?


Yes; I've won, and I know (at least) one other person to have done so.

http://i.imgur.com/tBqcjSK.png


You didn't do a lot of mashing keys right. This version really takes some thought.



Would you mind trying to explain your strategy? I have little intuition for this one :p


Continuously build up a specific square^, so this one I just kept moving things from the bottom right 2x2 up-and-left into the top-left 2x2. I avoided pressing S or D as much as possible (i.e. only when it was literally the only move I had, and then I'd press D (or S) once and continue as before).

This means that the sum of the top-left square is strictly increasing, and so "eventually" you'll win (assuming you don't fill up the rest of the board before that).

^In this case a "square" seems like it can just be one of the 2x2 ones, but in the original 2D case, this strategy has focus on building up just a single tile (one of the corners), or it doesn't work.


Holy crap, congrats. I still haven't even beat the first game.


This one seems a lot harder than the original.

I like it.


Now this is actually interesting!


Why would one choose wasd over ijkl if foreign keyboard layouts aren't going to be supported.


2048 - the new flappy bird


836


7088


2048


224!


waiting on N-d




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: