Skip to content

kryacose/2048-web-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#2048 Web API

2048 game engine written in Java with Spring and SpringBoot frameworks, accessible via a simple Web API

See it live on http://alanrusnak.com/2048

##Deploying

mvn package
java -jar target/2048.jar

and the app should be running on localhost:8080/2048/

##API Create a new game:

http://localhost:8080/2048/new/

Get game state:

http://localhost:8080/2048/{game-id}/

Make a move:

http://localhost:8080/2048/{game-id}/0   - to move up
http://localhost:8080/2048/{game-id}/1   - to move right
http://localhost:8080/2048/{game-id}/2   - to move down
http://localhost:8080/2048/{game-id}/3   - to move left

All requests result in a JSON response in this format:

{ 
"id": "3943a369-31a8-4b15-92b0-744660deab64", 
"score": 4, 
"board": { 
          "tiles": [ [ 0, 0, 0, 0 ], [ 0, 0, 2, 0 ], [ 0, 0, 0, 0 ], [ 0, 4, 0, 0 ] ] 
          }, 
"gameOver": false 
}

About

2048 game engine accessible via a simple Web API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 72.3%
  • CSS 11.3%
  • HTML 9.6%
  • JavaScript 6.8%