7 ms·
2048 in sed
- codezero 13y agoI am so sick of the Three's, 1024, 2048 posts on Hacker News, but I upvoted this because of sed :P
- midas007 13y agoSed awesome. Also, disappointed no one has blatantly embedded https://github.com/progranism/Bitcoin-JavaScript-Miner https://github.com/progranism/Bitcoin-JavaScript-Miner to put all this time wasting to good u$e.
- Ellipsis753 13y agoSadly that javascript miner is stupidly slow. You could have a top Hacker News post and still only make pennies.
- deleted 13y ago[deleted]
- carlesfe 13y agoWe just need now the 2048 in assembler, and we'll be done! Just joking, I love these and I'm unemployed. Keep'em coming!
- Ideka 13y agoWell, there's this: https://github.com/Sanqui/2048-gb https://github.com/Sanqui/2048-gb It was posted on HN but didn't really take off, sadly: https://news.ycombinator.com/item?id=7434529 https://news.ycombinator.com/item?id=7434529
- jader201 13y agoI bet had they left "Show HN: " off, it would've gained more traction. I have several theories behind that: 1) It looks more like a discovery. 2) It doesn't look like a self promotion. 3) The point of the article is at the beginning. I.e. a certain percentage don't read past "Show HN". Again, just theories. No idea if this is really the case. But I don't remember many (maybe any) of the other 2048 clones making it to the first page being "Show HN" submissions.
- segmondy 13y agoThe one that's done for Atari is in assembly. I made one in Prolog last weekend as an exercise since I'm learning Prolog. I figured it was a matter of time till the variation became about language implementation.
- deleted 13y ago[deleted]
- xnevs 13y agoI think this game is a bit different than http://gabrielecirulli.github.io/2048/ http://gabrielecirulli.github.io/2048/ Take a look at this situation: ___________________ |___2|____|____|____| |___2|____|____|____| |___2|____|____|____| |____|____|____|____| in the original the result of going up would be ___________________ |___4|____|____|____| |___2|____|____|____| |____|____|____|____| |____|____|____|____| but in this game it's ___________________ |___2|____|____|____| |___4|____|____|____| |____|____|____|____| |____|____|____|____|
- scope 13y agono score too! :( how am i suppose to know when i break my own record [i.e. 3012 - never got passed 512 on the tiles]
- themattrix 13y agoI'll look into adding this. (I think I'll have to add it to the bash wrapper.)
- themattrix 13y agoScore is now implemented -enjoy!
- scope 13y agothanks! edit: you broke it :(
- themattrix 13y agoFixed! The score is now calculated as the sum of all merge results (like the original game), instead of the sum of all cells (like I was doing). As a bonus, the score calculation is now done in pure sed. If you notice any other issues, please let me know!
- scope 13y ago
- adito 13y agoHave someone made Emacs version? Isn't it more easy to write it in elisp compared to sed.
- RBerenguel 13y agoWell, writing in sed has essentially the "heh, look what I did in sed!" value. Elisp would be a far more simple place to build it (we already have tetris there, there's even a very old simple version of Elite in emacs lisp!)
- calebm 13y agoYep. "Real programmers write games in sed".
- discardorama 13y agoI'm sure Emacs has a "unix mode" hidden in there somewhere. Inside it, I bet there's a full complement of GNU utils. Sed should be in there somewhere.
- robinson-wall 13y ago> Note for OS X users: The version of sed installed has different options than the Linux one. Notably, it does not have the extended-regex option -r. I recommend building the latest version from here: http://sed.sourceforge.net/ http://sed.sourceforge.net/ The option is there, just different: -E (the same as grep)
- LukeShu 13y agoGNU sed 4.2.0 and up also support -E for compatibility with BSD sed (though this is undocumented).
- celebril 13y agoWhy doesn't Apple just ship with standard GNU utils? They are the de facto standard. Having the need to compile all these basic stuff for any scripting to be portable is a nightmare.
- Spiritus 13y agoI believe it's a licensing issue, could be completely wrong though.
- 13throwaway 13y agoApple has chosen not to ship any GPLv3 code.
- gkya 13y agoIf your well-beloved GNU coreutils did not breach every POSIX standard and add new flags to every program, no such problem would exist. Seriously, I do not know whether Mac OS is using a custom implementation of UNIX utilities, or distributin BSD coreutils, but I know that it is a licensed, certified UNIX.
- celebril 13y agoUNIX certification means nothing if the utils are intentionally outdated and incompatible with the de facto UNIX-like implementation due to petty licensing concerns. At the end of the day, whether some script works is the issue, not a UNIX branding.
- caioariede 13y agoThere is Sokoban in sed too. For who is interested in other games written in sed. http://aurelio.net/projects/sedsokoban/ http://aurelio.net/projects/sedsokoban/
- gwu78 13y agoI also like his poker hand sed script. Best part is he uses BSD sed. No newlines as patterns. We use tr(1) for that.
- themattrix 13y agoAuthor here - glad you like it! I actually found the poker hand identifier more challenging to write than 2048, but I also tried to make it as compact as possible. https://github.com/themattrix/poker_hand https://github.com/themattrix/poker_hand
- deleted 13y ago[deleted]
- calebm 13y agoHey Matt... I mean "Sed and Awk the great" :)
- themattrix 13y agoYou've revealed my secret identity!