2048 As A Service
github.com
github.com
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!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
This was mostly because I was pretty strongly principled against forcing a particular display on the player. I wanted them to be able to explore via a text-based interface or a graphical one.
...and as it turns out, this was not the most ridiculously ambitious part of that project. :P
But don’t most MUD clients follow these principles? Playing with tf5 does give you quite a few advantages over playing with plain telnet.
(I can't help but wonder where and how 2048 will show up next.)
You might as well open up a SSH daemon on the default port without root password.
Perl one liner bro - check it out.
I guess that you could de-servicify it and create own2048, not that I know how it would differ from the original version...
Which seems to suggest April 1 protocol.
https://github.com/Semantics3/2048-as-a-service#zest-princip...
Is this the most elaborate April fool of the day?
Type curl -L http://2048.semantics3.com/hi/start to get started. Here is a full example on how to play it:
https://github.com/Semantics3/2048-as-a-service#full-example...
If you want a full game on the console:
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); }}'"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://domino.research.ibm.com/Comm/wwwr_ponder.nsf/Challeng...
is devoted to 2048...
Requires some 1D to 2D though.
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); }}' 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);
}
}