Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mahedi-kaysar/five-in-a-row-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Five-in-a-row game server

Rules and assumptions

  1. upon start, server waits for the two players to connect.
  2. More than two players can't connect in that server, however, limit is configurable.
  3. If one of the players disconnects, the game is over and all players will be removed.
  4. More that 1 game can't be started, however, limit is configurable.
  5. Server will decide the color of a corresponding player (PLAYER_O or PLAYER_X). Default color of the board is (NONE).
  6. For each turn, server will check if a player is won or game is tied.

Rest Endpoints summary:

Register Player:

curl -H "Content-Type: application/json" -X POST http://localhost:8080/game/register/player -d '{"name":"Mahedi"}'
curl -H "Content-Type: application/json" -X POST http://localhost:8080/game/register/player -d '{"name":"John"}'

Get Game state and player to next turn:

curl -X GET http://localhost:8080/game/board/state

In response: There are three possible status can be found.

INITIALIZED: means the game has been started
FINISHED: means the game is finished succesfully and someone has won.
TIED: means the game is finished with tie.  

Play next move:

curl -X GET http://localhost:8080/game/player/<playerId>/next-move/<columnToMove>
curl -X GET http://localhost:8080/game/player/1/next-move/8

Disconnect Player:

curl -X DELETE http://localhost:8080/game/player/<playerId>/disconnect
curl -X DELETE http://localhost:8080/game/player/1/disconnect

Required software

  • java 8+
  • mvn 3.6+

how to test and run

mvn clean test
mvn spring-boot:run

Test Coverage:

mvn test
cat target/site/jacoco/index.html

Please use this client for playing the game.

Future Work

  • Add more Unit test
  • Add Integration test
  • Improve java docs
  • Improve design
  • Add more feature.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages