Re:2048 As A Service
by fragmede on Tuesday April 01, 2014 @03:17PM
(#7510951)
Not sure if I'm doing it right, but http://2048.semantics3.com/2048/ (their mvp) just returns
{"message":"Please say hi..."}
[ Parent
| on HN ]
2048-as-a-service author here.
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); }}'
Re:2048 As A Service
by zaptheimpaler on Tuesday April 01, 2014 @03:27PM
(#7511030)
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...
Re:2048 As A Service
by HCIdivision17 on Tuesday April 01, 2014 @03:53PM
(#7511207)
It is nice to see the INTERCAL way of doing things making a comeback.
I think when they say MVP they might really mean AFJ, which would make the behavior you observed more understandable. Some AFJ purists would even claim it's the right way to do it under the methodology, which is arguably one of its major differences from the MVP credo.
What does AFJ mean?
April Fools Joke, I would assume.
Drop the /2048 from the end of the url and replace it with /hi/start/json
It really does appear to respond as advertised!
Is this the most elaborate April fool of the day?
https://github.com/Semantics3/2048-as-a-service#zest-princip...
Which seems to suggest April 1 protocol.