Marble Guessing Game Backend
Spring boot backend for marble guessing game inspired by Squid Game TV series.
Rules
- It is a two-player game with each player having ten marbles in their stake in the beginning.
- Each round, a player acts as the hider while the other acts as the guesser.
- Hider hides a non-zero number of marbles from their stake.
- Guesser secretly bets a non-zero number of marbles from their stake and guesses whether the hider's marbles are odd or even.
- If the guesser guessed correctly, the hider must give the guesser marbles equal to the number of marbles the guesser bet.
- If the guesser guessed incorrectly, they must give the hider marbles equal to the number of marbles they hid.
- Roles switch every round.
- Objective is to win all the marbles of the opponent.
Running the server
NOTE: Java must be installed on the system
- Clone the repository.
- Open a terminal in the root directory of the project (contains the
.gradle
folder). - Run
./gradlew bootRun
command.
or For VS Code
- Clone the repository and open the project.
- Install the spring boot extension pack from the extensions marketplace.
- Open any source code file and press
Ctrl + F5
to run the project.
Docs
- Run the server.
- Launch
http://localhost:8080/swagger-ui/index.html#/
in a browser of your choice.
Websocket endpoints
- Clients must connect to
http://localhost:8080/game
via a Stomp client using SockJS. - Once connected, the clients must subscribe to
/topic/gamestate/{gameId}
to listen to notifications sent by the server.
Postman collection
- Fork the collection from this link.
- Get
gameId
from the response of create game request and update the current value of thegameId
variable of the collection to use it in other requests.