bane 12 years ago

You know, I wonder if we're about to see another tetris phenomenon. One of the miracles of tetris is that the game mechanics scaled from a few dots on an 80s era LCD keychain game to HDTV and surround sound.

Some kind of generalized 2048 game, with different or harder goals every "level" and some tweaked mechanics and we could see another one.

  • lifthrasiir 12 years ago

    Yeah, it is as simple as changing every single mention of 2048 in the source code to 4096. My friend actually tried that and it was... a lot harder than 2048. (The 2048-AI fails to make 4096 for most games, for example.)

    https://github.com/youknowone/4096

    • hk__2 12 years ago

      regarding term2048, it’s as simple as:

          from term2048.game import Game
          Game(goal=4096).loop()
  • sdegutis 12 years ago

    I'd like to see a version that has a slightly bigger grid. So apparently there is a market for alterations.

    • hk__2 12 years ago

      I opened an issue to add different layouts for the UI.

  • BoppreH 12 years ago

    By replacing the numbers with colors you could scale it down to a pixel per piece. The tones would have to be chosen carefully, though.

    • Scaevolus 12 years ago

      A straightforward hue/rainbow progression might work. You need 11 colors to represent 2^1..2^11, so you could do {red, yellow, green, blue, magenta} * {normal, bright}, with 2048 as cyan.

      • pbhjpbhj 12 years ago

        Funny, I've actually been working on this today with rainbow shades and sounds on a modified board (with levels) and a more "child friendly" UI.

  • 1986v 12 years ago

    Someone should create a 2048/Tetris hybrid. Match the numbers into blocks as they fall to complete larger blocks. Talk about a challenge.

    • gms7777 12 years ago

      This sounds like an awesome game. It might be my weekend project. I'll let you know if it happens.

      • 1986v 12 years ago

        Rad, looking forward to the mind explosions.

  • shmageggy 12 years ago

    After thinking about 2048 a lot while making and refining the 2048-AI program [1], I don't think that will happen in its current form. The game has a perfect level of complexity to be engaging and interesting to newcomers, but it can be completely mastered with just a little bit of knowledge and practice. And now that the game has been out for a bit, the optimal strategies are pretty well known and easy to discover [2]. Of course, it will still be appealing to people who choose to learn it on their own, but it's certainly possible to master the game in under an hour with some help, unlike classics like tetris. In order to give the game good replayability, it will at least need some new twists like timed moves or adversarial AI or something.

    [1] http://ov3y.github.io/2048-AI/ [2] http://stackoverflow.com/q/22342854/1056032

    • bane 12 years ago

      I wonder if, instead of new blocks randomly showing up after you make a move, if they just showed up after a period of time. If a new block showed up right on top of an old one some kind of rule would take effect, like add them together, or the larger wins or something. As "levels" progressed, the rate these new blocks showed up would increase. The goal would probably have to be changed, instead of just getting to 2048, get to, or exceed, or come in just under some arbitrary number for the level or something.

      Might add new strategy elements to the basic idea. You might not want to make a move, hoping the next blocks add to a block that's already on the board...maybe even "hint" where the next blocks will appear, but not the value. Tetris after all shows you the next block that will appear.

jimhart3000 12 years ago

This is awesome and yet another way to kill my productivity!

I noticed something that I think is incorrect behavior based on my playing of the original. If I have a row that has 2 - 2 - 4, when I press right, it goes straight to 8, rather than the behavior that I think is supposed to happen - press right once and get 4 - 4, press it again and get 8. A minor difference but does actually change the gameplay a bit.

  • meylingtaing 12 years ago

    I'm having this issue too, which totally threw me off, as I've finally figured out how to sort of consistently beat the original.

antr 12 years ago

I'm genuinely addicted to this. I'd be very happy to pay $5 for a native 2048 iOS game – this will substitute my Flipboard use during my commute.

  • RBerenguel 12 years ago

    There's Threes (https://itunes.apple.com/us/app/threes!/id779157948?mt=8) which is similar but not the same (since it requires a 1 and a 2 to generate a 3, which makes it slightly more troublesome. I prefer powers of 2, too, they appeal my inner nerd.

    • ColinDabritz 12 years ago

      Some important differences: * the first step is explicitly 1 + 2 = 3 (which you mentioned), 1+1 and 2+2 do NOT add * You move all tiles a single space at once, rather than 'to the edge'. Note tiles only merge when they push together, so an edge or other cards restricting their movement. This is a side effect design decision of single space moving. I do not know if two pairs will merge, e.g. will 3 + 3 + 6 + 6 leave 6 + 12? I suspect it will, but I haven't seen it. * Numbers 1 and 2 both spawn, and there is a 'next number' indicator, although placement still appears random. (A 3 spawned in the tutorial, but I think that was a special case)

      Overall this leads to a very different feel to the game.

      Anything else I missed?

      • sp332 12 years ago

        3 + 3 + 6 + 6 can't make 6 + 12 because the tiles can only move one step. The ones near the edge will merge first (depending with way you push it).

    • antr 12 years ago

      Thx. I have just bought it, $3. Its almost the same idea, with slightly different mechanics. The 2048 animations are much "better" imho.

      • RBerenguel 12 years ago

        Yeah, after Threes, 2048 felt a little easier, though. Enjoy Threes, I already thing it was well worth it: real moment killer without being excessively mindless

  • saurik 12 years ago

    What would this offer over the official version other than "doesn't take up a tab in MobileSafari" (which could be fixed if the developer just added the right meta tags)?

    • antr 12 years ago

      - Play offline

      - Save game

      - Save score

      - Better UX (e.g. right now I need to refresh to start a new game) not UI and a bunch of other obvious stuff relevant to all native apps.

      • hk__2 12 years ago

        > - Play offline - Save game - Save score

        I don’t know what is Mobile Safari support for these, but you can play 2048 in your browser without Internet connection once you downloaded the page, and you can save game/scores in localStorage.

      • saurik 12 years ago

        The new "best score" feature is saved in localStorage, so that's now already covered. While the existing app doesn't cover all of your other use cases, those have nothing to do with being native, and you could even download the HTML and fix some of them yourselves in a few minutes: adding a cache manifest (three line text file and one attribute in the HTML) would make fully-offline possible (and when combined with the aforementioned meta tag, gives a pretty native experience, as the app at this point would work without Internet access, with its own icon and its own entry in the multitasking list). It would also be trivial to implement saving games with the web implementation, probably an addition 20 lines of JS (although the length of the game is capped, so I'm surprised you want this). As for having to reload to start a new game, I'm surprised that that matters to you: but adding a "new game" button (that could just reload the page, which would be instantaneous with the cache manifest) would also be trivial. Like, if you are willing to spend $5 on this, maybe you'd be willing to spend 15 minutes? ;P

  • bernatfp 12 years ago

    Have you considered adding the original 2048 website to your homescreen as a webapp? Works like a charm to me.

ErikRogneby 12 years ago

I hadn't used pip before. I wonder how many different package managers I have installed now? Figuring out how to install pip on OSX I discovered "easy_install" which I hadn't used before.

sudo easy_install pip

pip install term2048

  • emidln 12 years ago

    from twitter (@gardaud):

        “What’s pip?”
        “A python package manager”
        “How do I install it?”
        “easy_install pip”
        “What’s easy_install?”
        “A python package manager”
    • gcr 12 years ago

      Haha, no kidding.

      It's not so bad with the right tools. In particular, "virtualenv" lets you make "environments" for python packages so you can install these things without needing root access:

      - Use your distro package manager to install virtualenv

      - Make a new virtual environment with: virtualenv /tmp/vv

      - "Enter" the environment: source /tmp/vv/bin/activate

      - You now have "pip" so you can say pip install term2048

      - Play

      - rm -r /tmp/vv and log out; everything's all cleaned up now.

girvo 12 years ago

Doomed. I just got a new job, and I'm definitely going to get fired now... ;)

andyzweb 12 years ago

going to make a PR that has support for vi-like navigation, (hjkl)

  • koralatov 12 years ago

    That would be amazing. Thank you.

BoppreH 12 years ago

I made a terminal clone too, but to play with bots: https://github.com/boppreh/2048bot

I didn't get around to write a good AI, but you can uncomment two lines in the main to play yourself. The interactive play is not colorful or as polished, but works the same way.

If you want to write a bot yourself, just call "play_bot(logic)", where "logic" is a function that takes a board state and returns a play. "play_bot" returns the highest piece created.

moron4hire 12 years ago

Remember when we were 12 years old and this was how we wrote all of our games? Hell, not just games, anything.

  • Jtsummers 12 years ago

    Not at 12 for me, I didn't start programming my own games until high school. But this would actually be fun to hack out on my old TI-85 or HP-48G (too bad both got water damaged).

kostja_gee 12 years ago

An android app would be nice, too.

  • TravCav 12 years ago

    search for 1024

  • k3oni 12 years ago

    See "Even" in the Play Store.

gren 12 years ago

Awesome, we have a multiplayer version, a bot version, a terminal version, what's next? Who's gonna make the flappy bird version?

  • rbonvall 12 years ago

    Pure-CSS-zero-lines-of-javascript version.

    2048-as-a-monad version.

    2048-as-a-jquery-plugin version.

    • hablahaha 12 years ago

      I can't imagine how a pure CSS version would work...

DrinkWater 12 years ago

oh yeah, now i don't even have to leave my terminal! Thanks a lot!

sdfjkl 12 years ago

Now make a web version of the terminal version.

  • Sheepshow 12 years ago

    Write it in C then compile it to JS with emscripten

egeozcan 12 years ago

This makes it extremely easy to get lost while playing the game. Think about your estimations and consider yourself warned.

joshlegs 12 years ago

I read this as "What the terminal will look like in the year 2048."

I was clearly wrong in my interpretation

Pitarou 12 years ago
    $ tail ~/.bash_history
    open http://news.ycombinator.com
    pip install term2048
    term2048
    term2048
    term2048
    term2048
    term2048
    term2048
    term2048
    pip uninstall term2048

Do you see what you've done?

delinka 12 years ago

A little buggy: It'll collapse 8,4,4 into 16 in a single move when the original does not. Not always, and I have no idea how to reproduce it. Maybe I should just chalk it up to accidental double-bounce on the keyboard?

  • hk__2 12 years ago

    This has been fixed in v0.1.6, thanks for reporting it!

hk__2 12 years ago

Thank you everyone for the feedback, I fixed the collapse bug that was reported by a few users in v0.1.6, update with `pip install -U term2048`.

rabino 12 years ago

Damn you, you beat me to it.

I've been playing with GoLang lately and started to implement 2048 this week as a learning exercise. Nicely done!

  • Jtsummers 12 years ago

    Put it on a server, let people telnet to port 2048 (anything else using this yet?) and play the game. Store high scores and display standings.

    EDIT: Still in the window! 2048 is not used by many projects. So essentially zero risk of a port conflict hosting this on a server with other services running.

hackmiester 12 years ago

This seems to need a "pip install argparse" but that's not included as a dependency. Pretty cool though!

codegeek 12 years ago

final nail in the coffin :). a highly addictive game in the terminal. Damn you hackers!!

Love text based games and bonus for being in the terminal. Btw, I know a few p.eople mentioned that it collapses 2-2-4 kind of combinations in one go and I noticed that too. But, you know what, I personally like this variation.

  • mikecarlton 12 years ago

    Stay away from Rogue then -- I spent way too much time in grad school on that one!

andyhmltn 12 years ago

So now I can play this insanely addicting game while looking like I'm working. This is not good!

mihok 12 years ago

Love it! Is there a way to change the colors? 4 is Incredibly hard to read in my terminal

  • hk__2 12 years ago

    There’s no way to have custom colors for now, but I can change the default colors. I’m on the collapse bug that was reported by a few people right now, will check back on your issue just after.

    Edit: I’m on it.

    Edit 2: I added a `--mode` option in the last version (0.1.7) to change the default colors mode. Use 'dark' on a dark background and 'light' on a light one. For now it only replaces dark blue with white on dark mode and yellow with black on light mode.

    TL;DR: update with `pip install -U term2048` and use `term2048 --mode dark`.

    • mzs 12 years ago

      Thanks, it would be sweet if you could use the VI keys or WASD instead of arrows (would work on Windows then)and if you could use A-K instead of the decimal numbers. In that way the aspect ratio could be more square, which I think would improve the ease of noticing chains.

edwardchiapet 12 years ago

Great! At least now I can play in the terminal covertly and no one will even notice!

guidopallemans 12 years ago

We need a javascript implementation!

oh wait...

tlongren 12 years ago

Well that's it. Productivity today has been shit and I blame this.

rathboma 12 years ago

FYI - doesn't seem to install with python 3.3

  • hk__2 12 years ago

    The last version (0.2.1) should support Python 3.2 and 3.3.

michelutti 12 years ago

please, stop it :( how can I work this way?

2810 12 years ago

omg.. now i can't even work in office