

Show HN: 2048-as-a-service, an API to build complex 2048 based apps - vinothgopi
http://blog.semantics3.com/announcing-2048-as-a-service/

======
vinothgopi
tl;dr paste this in your console for demo

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); }}'

