Live data from Hacker News

2048 As A Service

github.com

31–40 of 54 posts

Re: 2048 As A Service

#32

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).

With MMS you could get pictures back :)

Re: 2048 As A Service

#33
post #21
post #19

That "Sexy Perl one-liner" is hilarious.

For reference: 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 = ; chomp ($userInput); if(defined($keyMap{$userInput})…

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 = ; 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

#35

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

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

Re: 2048 As A Service

#36
post #21

Earlier quoted context omitted.

For reference: 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 = ; chomp ($userInput); if(defined($keyMap{$userInput})…

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 = ; chomp ($userInp…

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 = ;
        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

#37
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.

Re: 2048 As A Service

#38

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 i…

I'm just worried in reality it would just mean a flood of a thousand clones in the appstore.

Re: 2048 As A Service

#39

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 i…

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/

Re: 2048 As A Service

#40
post #38

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 i…

I'm just worried in reality it would just mean a flood of a thousand clones in the appstore.

Sure, but maybe that could be a good thing. For example, you could provide an API for Chess that ranks players across apps. You could use a Facebook ID or similar to merge identities across applications. Then players could choose the chess app they prefer and still be engaged with the larger community.
Post reply on HN