
2048 As A Service - netvarun
https://github.com/Semantics3/2048-as-a-service
======
hcarvalhoalves

        This API follows ZEST principles.
    
        All requests must begin with a /hi.
    
        Failure to do so will result in a 800 'Please say hi...' error.
    

Priceless!

------
netvarun
2048-as-a-service author here.

Do also checkout our demo showcase app built using the 2048-as-a-service API:

2048 - Startup Growth Edition (MVP) -
[http://2048.semantics3.com/2048.html](http://2048.semantics3.com/2048.html)

~~~
ycaspirant
Doesn't work for me. I'm using Safari on iOS 7.1.

~~~
zachlatta
Doesn't work for me either. Latest version of Chrome on Android.

------
javindo
This feels like HN satire but someone has actually gone and written the code
so it's fairly elaborate...

~~~
korethr
IMO, the best April 1st jokes are both good satire and well thought out enough
to actually be implemented. Consider that RFC 1149 was intended as a joke,
only to actually be successfully implemented years later.

------
jordanlev
I get that this is a joke, but I do think a really cool concept for a game
would be one where there is just an API for the "state" and that is
responsible for the mechanics and rules of the game, but that you would build
your own custom client for the UI. For example, some kind of spaceship battle
game where you create your own interface for controlling the ship... it would
be kind of a meta-game where creating the interface a certain way might give
you advantages in terms of efficiency versus others.

~~~
chch
Schemaverse[1] could be considered something similar, I think, down to the
"space-based strategy game", although it is controlled by raw SQL queries
instead of an API.

[1] [https://schemaverse.com/](https://schemaverse.com/)

~~~
jordanlev
Wow, that's really cool -- thanks!

------
cs702
In hindsight, this seems... inevitable ;-)

(I can't help but wonder where and how 2048 will show up next.)

------
keehun
10/10 would trust a ginormous 1-line Perl script again

------
userbinator
Finally, 2048 is now _enterprise-ready_.

~~~
mmanfrin
I see no Java in this repo?

~~~
zwegner
And where are the unit tests?!?!

~~~
alttab
Unit tests? You mean functional api level load testing?

------
pearjuice
Are there seriously people running obfuscated Perl scripts from third parties
in a terminal with root access?

You might as well open up a SSH daemon on the default port without root
password.

~~~
JeremyMorgan
Yes, you see Perl is hip now. And since the hipsters barely learned how to
make an alert in JS before calling themselves a "full stack dev" they really
don't know any better.

Perl one liner bro - check it out.

------
symmetricsaurus
This is hilarious. This probably won't be, but should be the final entry in
the series of 2048 clones.

I guess that you could de-servicify it and create own2048, not that I know how
it would differ from the original version...

~~~
OnACoffeeBreak
A desktop application that is distributed exclusively on floppies?

~~~
ekianjo
We are still missing the C64 version.

------
fragmede
Not sure if I'm doing it right, but
[http://2048.semantics3.com/2048/](http://2048.semantics3.com/2048/) (their
mvp) just returns {"message":"Please say hi..."}

~~~
zaptheimpaler
This is actually documented in the API. Turns out the API just wants your
program to be polite and say hi when calling it.

[https://github.com/Semantics3/2048-as-a-service#zest-
princip...](https://github.com/Semantics3/2048-as-a-service#zest-principles)

~~~
HCIdivision17
It is nice to see the INTERCAL way of doing things making a comeback.

------
aspensmonster
Edit: It's missing a snarky game over message. Something like "you pivoted too
late" would be perfect for a game like this, don't you think?

"Unstoppable! You are the next Rap Genius!"

"Growth Hacker Extraordinaire! You are the next Optimizely!"

I like it more than the other offers that April Fools has provided thus far.
Somewhat reminiscent of this thread:
[http://chan.installgentoo.com/g/thread/38087806](http://chan.installgentoo.com/g/thread/38087806)

------
li-ch
And Threes!'s creators becomes more bitter and sour...

------
malkia
I would like to see an Excel extension with boss-mode key.

------
tromp
Slightly off-topic, but even this month's Ponder This challenge

[http://domino.research.ibm.com/Comm/wwwr_ponder.nsf/Challeng...](http://domino.research.ibm.com/Comm/wwwr_ponder.nsf/Challenges/April2014.html)

is devoted to 2048...

------
BobChubby
I remember I used to play hangman by texting letters to a phone number and it
would reply with how much of the word I had figured out. It would be awesome
to be able to play 2048 over SMS (but painstakingly slow to complete).

~~~
servowire
COuld be formatted on 1 line. Like this: x-x-x-x-x-x-2-4-4

Requires some 1D to 2D though.

~~~
matchu
SMS seems to support newlines on my phone. Not sure how widely supported that
is, though.

------
largote
That "Sexy Perl one-liner" is hilarious.

~~~
largote
For reference: perl -e 'my $host =
"[http://2048.semantics3.com/hi/";my](http://2048.semantics3.com/hi/";my) $cmd
= "curl --silent -L $host"."start";my $output = `$cmd`;my $session_id =
$output;$session_id=~s/. _?ID:\s(\w+)._ /$1/si;my %keyMap = ( 'w' => 0, 'd' =>
1, 's' => 2, 'a' => 3);print STDERR $output,"\n";while(1) { print STDERR
"Input (w - up, a - left, d - right, s - down):\n"; my $userInput = <STDIN>;
chomp ($userInput); if(defined($keyMap{$userInput})) { $userInput =
$keyMap{$userInput}; } else { print STDERR "Invalid move.. w - up, a - left, d
- right, s - down\n"; next; } my $cmd = "curl --silent
$host"."state/$session_id/move/$userInput"; my $output = `$cmd`; print STDERR
"\n$output\n"; if($output=~/Message:/si) { exit(0); }}'

~~~
netvarun
HN formatting screws up the code :(

This will work:

    
    
        perl -e 'my $host = "http://2048.semantics3.com/hi/";my $cmd = "curl --silent -L $host"."start";my $output = `$cmd`;my $session_id = $output;$session_id=~s/.*?ID:\s(\w+).*/$1/si;my %keyMap = ( 'w' => 0, 'd' => 1, 's' => 2, 'a' => 3);print STDERR $output,"\n";while(1) { print STDERR "Input (w - up, a - left, d - right, s - down):\n"; my $userInput = <STDIN>; chomp ($userInput); if(defined($keyMap{$userInput})) { $userInput = $keyMap{$userInput}; } else { print STDERR "Invalid move.. w - up, a - left, d - right, s - down\n"; next; } my $cmd = "curl --silent $host"."state/$session_id/move/$userInput"; my $output = `$cmd`; print STDERR "\n$output\n"; if($output=~/Message:/si) { exit(0); }}'

~~~
eCa
More readable:

    
    
        my $host = "http://2048.semantics3.com/hi/";
        my $cmd = "curl --silent -L $host"."start";
        my $output = `$cmd`;
        my $session_id = $output;
    
        $session_id =~ s/.*?ID:\s(\w+).*/$1/si;
        my %keyMap = ( 'w' => 0, 'd' => 1, 's' => 2, 'a' => 3);
        print STDERR $output, "\n";
    
        while(1) {
            print STDERR "Input (w - up, a - left, d - right, s - down):\n";
            my $userInput = <STDIN>;
            chomp ($userInput);
    
            if(defined($keyMap{$userInput})) {
                $userInput = $keyMap{$userInput};
        	}
        	else {
                print STDERR "Invalid move.. w - up, a - left, d - right, s - down\n";
                next;
        	}
    
        	my $cmd = "curl --silent $host"."state/$session_id/move/$userInput";
        	my $output = `$cmd`;
        	print STDERR "\n$output\n";
    
        	if($output=~/Message:/si) {
                exit(0);
        	}
        }

------
kremlin
I was just thinking about trying to write a command line 2048 and then I see
this.

~~~
mimiflynn
[https://github.com/bfontaine/term2048](https://github.com/bfontaine/term2048)
is a good one ;)

------
barretts
This seems like a lot of work for a joke.

