REST API for playing Hangman creating using Spring Boot. It uses a word list from Duke's CS Department.
git clone https://github.com/sastani/Hangman
- Download maven from
https://maven.apache.org/download.cgi
- Extract the maven archive using
unzip
ortar
- Add the bin directory of the extracted folder to your
PATH
Run the following to build the project:
mvn package
java -jar target/Hangman-0.0.1-SNAPSHOT.jar
To get a new game:
GET localhost:8080/new
To make a guess:
POST localhost:8080/guess{"game":[gameId], "guess":[character]}
To get a JSON object containing game data for every game in the current session make the following API call:
POST localhost:8080/games
If you pass a string of characters that is longer than one character, it only keeps the first character and uses that to make a guess.
Additionally, if you guess a character that is correct multiple times, you are not penalized. However, if you guess a wrong character multiple times, you will lose a turn each time.