项目作者: qasimkhalid
项目描述 :
Rock Paper Scissors Game
高级语言: Java
项目地址: git://github.com/qasimkhalid/RockPaperScissors.git
API to play Rock - Paper - Scissors - Lizard - Spock

Instructions
Configuration:
- Clone the repository.
- Open the application.properties file from
/src/main/resources/application.properties. - Add the name of your database here (add username and password, if necessary).
spring.datasource.url=jdbc
//localhost:5432/{yourDatabaseName}. - Run and Play it using any API client (e.g., Postman).
- Enjoy!
Game Play:
- Player sends API a move to play using
POST request to the http://localhost:8080/rps/play/ endpoint in the following format with one of the possible legal moves (i.e., rock, paper, scissors, lizard, spock).
{ "name": "Ponky", "move": "rock"}
- The game engine chooses a move in reaction to player’s choice and the player receives a game result in a following format.
{ "moves": [ { "name": "Ponky", "move": "rock" }, { "name": "Bot", "move": "lizard" } ], "result": "Ponky wins"}
Accessing Results From Database:
As the game results are stored in the PostgreSQL, they can be accessed anytime using GET request to the http://localhost:8080/rps/result/ endpoint.
Tests:
- Unit Testing: Game Logic (e.g., MatchShouldDraw and PaperWinsAgainstRock).
- Postman for API testing.
TODO:
Unit tests for Game Controller.
- Routes should work! - test controller and urls - make custom http client and try to hit the API endpoints with proper and improper data.
- Make tests to check request body in proper JSON format.
- Make dummy json body to check if JSON is valid or not.
- Is the player move legal?