Live data from Hacker News

2048 in the terminal

github.com

11–20 of 90 posts

Re: 2048 in the terminal

#13
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.

Re: 2048 in the terminal

#15

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

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).

Re: 2048 in the terminal

#18
post #16

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!

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.

Re: 2048 in the terminal

#19
post #14

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

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`.

Post reply on HN