12 ms·
Hey, author here! I'm pretty overwhelmed that this made it to the top of HN without me even thinking of posting it here :) I made this game as a fun weekend pr
by terabytest 13y ago
Hey, author here! I'm pretty overwhelmed that this made it to the top of HN without me even thinking of posting it here :)
I made this game as a fun weekend project, inspired by another game called 1024 (https://itunes.apple.com/us/app/1024!/id823499224 https://itunes.apple.com/us/app/1024!/id823499224) and a spinoff called 2048 (http://saming.fr/p/2048/ http://saming.fr/p/2048/). I did mine to add animations to the latter, which was a bit hard to play without them.
I discovered Threes only today, and I had no idea it looked so similar. I searched a bit and it appears as if 1024 is also inspired by Threes, so my game is probably the last of a long chain of clones :P
The code is also open-source. You can find it here: https://github.com/gabrielecirulli/2048 https://github.com/gabrielecirulli/2048
Feel free to ask me anything, and thanks to everyone for the attention! :)
By the way, my highscore is somewhere around 6000. Admittedly, I'm quite bad at playing my own game :P
EDIT: Make sure not to get addicted!
EDIT 2: The game now has swipe gestures and vim keys support (added by @rayhaanj)!
- ctdonath 13y agoMake sure not to get addicted! Hah. It's binary crack.
- iamdanfox 13y agoOut of curiosity, I'd love to hear what your Google Analytics graphs look like! How long to people spend playing it?
- terabytest 13y agoRight now there are around 2100 people on the site and an average visit duration of around 4 minutes :)
- deletes 13y agoHow many reached 2048?
- terabytest 13y agoThe latest stats show no "game-win" events :P It might just be a matter of time though. EDIT: oops, there was a bug in the win/lose tracking so I probably missed out on a few wins. I fixed it now, so it should hopefully track it if someone else wins!
- yeldarb 13y agoI just beat it! First try.. but I've been addicted to Threes for the past week or so. http://i.imgur.com/nf25AVZ.png http://i.imgur.com/nf25AVZ.png
- deletes 13y agoI'm gonna call fake on this one.
- anon4 13y agoWith enough tries anything is possible. There is probably even a person who ascended nethack on his first try (using the wiki of course, we're still talking things with p > 0) and didn't play it again because it's too easy and boring.
- eru 13y agoI've seen that. Wiki, #nethack, valkyrie, and some decent but not extraordinary luck.
- araes 13y agoThere's actually a semi-optimal strategy that nearly guarantees winning if you're diligent about it. Just build a stairstep pattern with the highest numbers in the bottom corner of the stairs. Then basically combine sideways and downward and "always" resist the temptation to push up. Its kind of how some tri-diagonal matrix algorithms work. The only problem is you have to be fastidious about never using the one direction you've reserved as your excluded case (Up in my example) as that can screw your staircase by putting a [2] right underneath your wonderful [1024]. Just move blocks back and forth, waiting for the right blocks to create combo patterns, while generally storing lower cost blocks on the outside of the stairs, and then snake them through the stairs when you get a chain set up. Ex: x x x 2 x x 2 4 x 2 4 8 2 4 8 16
- rayanm 13y agoI've started playing threes a week ago. Both threes and 2048 are fun to play. Except that I think in threes the challenge starts earlier in the game and every step counts and you can easily get into a deadlock. Can't wait to see the source code and analytics. Maybe you want to add on the page the highest score :)
- blueblob 13y agoThis is very fun and addicting, now I just have to get some work done.
- palakchokshi 13y agoSo addictive. You know since tiles slide to the edge it would be great if this took advantage of accelerometers to allow tile combining by tilting. I know this is a browser game but if you ever create an app using the tilt motion to combine tiles would be awesome. :)
- reubenmorais 13y ago>I know this is a browser game but https://developer.mozilla.org/docs/WebAPI/Detecting_device_orientation https://developer.mozilla.org/docs/WebAPI/Detecting_device_o...
- phillmv 13y agoHoly shit I just lost like 45 minutes to this.
- wiredfool 13y agoEvil evil game.
- terabytest 13y agoI've been playing this all day today. I basically created my own demise.
- eru 13y agoJust be glad you are already immune to Tetris.
- awjr 13y agoBest strategy (for me) seems to be to play it like tetris. Never ever use the up key and create a row at the bottom where everything collapses into it. This sort of clicked towards, oooh I don't know about 1:30am this morning.
- lugg 13y agoThat sort of works, I've been using a similar strategy but switching what I call "bottom" whenever the moment suits.
- RealCasually 13y agoVery fun game! Love the dynamic, couldn't get higher than 256 though. Also check out Fives for Android--somewhat similar: https://play.google.com/store/apps/details?id=com.rcg.fives https://play.google.com/store/apps/details?id=com.rcg.fives
- jackmaney 13y agoLikewise. I had one game where I had a 256 block and two 128 blocks, but I ran out of room to maneuver before I could combine the 128s to another 256 and then combine the 256s to a 512.
- ilovecookies 13y agoby pressing up-right-down-left, then repeat, I managed to get to 512 two times...
- anon4 13y agoI did it by pressing up-left-down-right, repeating each direction as many times as possible. That's the worst part - knowing that your carefully calculated playthrough is actually no better than someone just pressing the keys in a set order.
- 0-o 13y agoRan your strategy 162 times with autoit of which the following blocks came by: [128]: 150 times, [256]: 36 times, [512]: 13 times, [1024]: 0 times. Anyone else a good suggestion for an optimal "blind" strategy?
- wakeless 13y agoUUDDLRLRBA
- ilovecookies 13y agoPerhaps I had a little bit of luck. But this shows you can easily get to 256 with little dedication. After which you can start to puzzle things together. Also about your autoit "analysis" 36 + 150 + 13 != 162
- seventytwo 13y agoYou definitely need to have some kind of counter for how many times someone has reached 2048, and out of how many games played.
- gridspy 13y agoOr an expansion on that. Keep track of how many 128s, 256s etc you've ever formed. Show them as big counters directly under the game with an animation when you create any of them.
- benjamincburns 13y agoLog scale histogram? Edit: Actually all you need to store is the highest block achieved, and the number of times it's been hit. For instance, if you've only ever generated 2 8's, then you know that you've had 4 4's, and 8 2's... Edit 2: Does the game allow four 2's to cascade into an 8? If so, maybe you could also store combo stats. It'd be way cooler to smash together four 256's than to smash together two 256's two times. Not sure how that plays into the histogram.
- IanCal 13y ago> For instance, if you've only ever generated 2 8's, then you know that you've had 4 4's You know you've had at least 4 4's, but you could have had more.
- benjamincburns 13y agoAh. Lower bounds... they get me every time!
- primitivesuave 13y agoI haven't been this addicted to a game since Drop7.
- andrelaszlo 13y agoSame!
- deleted 13y ago[deleted]
- pavel_lishin 13y agoI was so addicted to Drop7, and so annoyed at the crappy Android version, I made my own HTML/JS version with appcache, so I could play it in chrome offline: https://github.com/pavellishin/drop7 https://github.com/pavellishin/drop7
- primitivesuave 13y agoThis is fantastic! Thanks so much for sharing, I learned so much from reading your very elegant and well-commented code. Just in case anyone is looking at this and wants a direct link to play pavel_lishin's version, here's the raw github version: https://rawgithub.com/pavellishin/drop7/master/drop7.html https://rawgithub.com/pavellishin/drop7/master/drop7.html Side note: I got hooked on Drop7 during my first semester in college. I was fascinated by the game and wrote a simulator to pick the optimal move: https://github.com/keshavsaharia/Drop7Simulator https://github.com/keshavsaharia/Drop7Simulator
- pavel_lishin 13y agoOoh, nice! I thought about writing some sort of AI to play for me, but never got around to it. (Plus, it felt weirdly oroborous-like.)
- ToastyMallows 13y agoAwesome work, thanks for posting. I too was annoyed at Android support. It could be one of their more popular games if it was just updated a little.
- a13xnet 13y agoGreat "time waster" - just got 5752 score from first try! Very well executed, who cares if its a clone! :) Great job!
- pje 13y agoPlease allow me to throw money at you somehow
- jf 13y agoYes! At the very least put up a BTC or Dogecoin address we can send donations to!
- greggman 13y agoOr maybe go buy Threes which this is a descendant of? http://asherv.com/threes/ http://asherv.com/threes/ Nice clone but it's definitely a clone and so should be treated as such.
- eps 13y agoI have Threes and they way way over-designed it. Also it's rubbery interface is really quite annoying. This one however is a perfection - simpler idea, pure gameplay, subtle animations and UI mechanics. It really beats Threes hands down even if it's a "clone".
- kibibu 13y agoYep, and if you have a spare couple of minutes to play a game, the first minute is spent loading it.
- deleted 13y ago[deleted]
- epsylon 13y agoiDevices only. Bleh.
- oneeyedpigeon 13y agoThey've been promising an android version for some time now. If they don't hurry up, though, they'll get beaten to it by clones.
- mantrax 13y ago"EDIT: Make sure not to get addicted!" Oh, no we have another Flappy Story in the making here!
- sebastian_stugk 13y agoCan't stop playing ;-)
- sebastialonso 13y agoYou bastard! I had to work today!
- gopalv 13y agoProgrammer Step #2 - write an automated solver :)
- siddboots 13y agoI thought about this for 5 minutes and really got nowhere. Can anyone come up with a nice analytic way to think about an algorithm? There are a couple of brute force approaches: a) always pick the direction that will result in the most blocks to combine, b) always pick the direction that will result in the largest score.
- lancefisher 13y agoI think you want to keep the large numbers in the corner.
- sajithdilshan 13y agoHow about using A* algorithm?
- TophWells 13y agoI know someone was working on an AI that plays Threes (the game that inspired this one). Haven't seen any code from him though. http://forums.toucharcade.com/showthread.php?p=3142737#post3142737 http://forums.toucharcade.com/showthread.php?p=3142737#post3...
- kaybe 13y agoTwo hours lost at uni today and checking hn first thing back home... nooooooo! I will now proceed to waste time. Good job! :) edit: Ok, some random friend just emailed me and told me to check out your game. This friend does not hang out at the online places I do. It seems to be on fire!
- karangoeluw 13y agoShit I just spent like 4 hours. I have final exams next week. You are evil!
- birdmanjeremy 13y agoWow, that was fun, thanks! It starts to make sense after a while. Are lower or higher scores better? I'm at 21,204. http://imgur.com/4tnVPZ4 http://imgur.com/4tnVPZ4
- toolslive 13y agoa bit lower: http://imgur.com/yPnUt8N http://imgur.com/yPnUt8N
- joebobfrank 13y agoEven lower: 20148 http://imgur.com/28YNfDS http://imgur.com/28YNfDS That's pretty damn near optimal, might have had an extra 2 when doing the final collapse, can't remember.
- crazykt 13y agoEven lower : 20132 http://imgur.com/dWiXGaW http://imgur.com/dWiXGaW
- vorg 13y ago> this made it to the top of HN without me even thinking of posting it here Good for beta testing it. Unlike with Threes, there's no real reason to use numbers since they're all powers of 2. If you used letters (A, B, C, ...) you could market it to non-HN sorts, and have a version of the game in a 5x5 grid, or, more to the point, in a 6x6 grid with letters A to Z. Most people in the world know the order of letters in English.
- eru 13y agoGood idea with the letters, but perhaps not necessary. People are happy with simple numbers. Just look at Sudoku which doesn't use A to I.
- vorg 13y agoI'm certain letters are necessary for a 5x5 or 6x6 board. M is better than 16,384, and Z far better than 67,108,864.
- eru 13y agoWhy? Instead of A, B, C, you can go with 1, 2, 3. Ie use the binary logarithm of the numbers.
- vorg 13y agoGood idea with the simple numbers, and certainly necessary to use some tokens other than what this 2048 app uses so we can have a version of it in a 5x5 or 6x6 grid. When you wrote "Good idea with the letters, but perhaps not necessary. People are happy with simple numbers. Just look at Sudoku which doesn't use A to I", I thought you hadn't noticed my mention of the larger grid, which was really the main point of my comment and maybe I should've worded it differently. Though if you'd begun your comment differently, i.e. "Good idea with the larger grid, but perhaps the letters aren't necessary. People are happy with simple numbers. Just look at Sudoku which doesn't use A to I", I wouldn't have felt the need to reply to correct a perceived communication mistake.
- jonalmeida 13y agoI can't tell if I despise you or admire you, all I know is that there was light outside my window when I first began playing this, and now it's pitch dark. Upvoted you to show my anger! :)
- loahou04 13y agoThanks a lot jerk...now ive lost 2 hours of sleep because of this game! Keep up the good work!
- prasio 13y agoI launched a very similar called Even last week on Android -- http://bit.ly/even-game http://bit.ly/even-game -- have fun!
- prasio 13y agoIt's very coincidental that my game called Even, based on very similar gameplay was launched this past Friday -- http://bit.ly/even-game http://bit.ly/even-game (in case folks on Android want to play it)
- SnaKeZ 13y agoCongratulazioni Gabriele ;-)
- kngspook 13y agoOh, _now_ you tell me not to get addicted! >:( You should've made that a splash page to the site, not an edit to a comment on the submission link. But seriously, well done. :) Completely destroyed my productivity.
- elleferrer 13y agoAh! This game IS addicting! My highest so far is around 3500.
- filipm 13y agoHi Gabriele, I created a mirror of your project with an easier memorable name at http://2048.mx/ http://2048.mx/ :-) Hope that's fine. It might take an hour or so for the domain to be accessible for everyone due to DNS cache.
- SonicSoul 13y agoawesome game. I love the math 2 * 1024 = 2048 4 * 512 = 2048 8 * 256 = 2048 .. 1024 * 2 = 2048 20480 <-- minimum points is there a elegant formula to get to the minimum required points?
- mglauco 13y agoGreat job!
- karangoeluw 13y agoI won! http://imgur.com/Y8oVTeQ http://imgur.com/Y8oVTeQ
- esalman 13y agoThanks for the swipe gesture support, had fun playing it on the way home.
- infinity 13y agoFinally, at 2:26 a.m. I was successful with a score of 21000 ... that was fun, thank you!
- AJ72 13y agoTotally cool, and addictive. Not exactly news, but at another level, completely HN worthy
- crag 13y agoI just wasted 60 mins playing this game. And I think I'm hooked. I hate you. ;)
- kartikkumar 13y agoExtremely addictive and awesome patterns! Well done!
- mzs 13y agoJust wanted to let you know (but wanted to wait before somebody would down vote such a comment here) that I really enjoyed your game, thanks and cheers!