The 15 Puzzle (also called Gem Puzzle, Boss Puzzle, Game of Fifteen, Mystic Square, and more) is a sliding puzzle. It has 15 square tiles numbered 1 to 15 in a frame that is 4 tile positions high and 4 tile positions wide, with one unoccupied position. Tiles in the same row or column of the open position can be moved by sliding them horizontally or vertically, respectively. The goal of the puzzle is to place the tiles in numerical order (from left to right, top to bottom).
Full description: Wikipedia
This project is a Java Spring backend API.
No database is used.
Frontend application will be made later :)
Local link: http://localhost:8080/swagger-ui/index.html
Create a new game instance.
- Method:
POST
- URL:
/api/game
- Request Body: None
- Response: Game ID
Retrieve the current state of the game board.
- Method:
GET
- URL:
/api/game/{gameId}
- Response: Current state of the game board
Make a move in the game by specifying the tile value to move.
- Method:
PUT
- URL:
/api/game/{gameId}/move
- Request Body:
tileValue
(integer): The value of the tile to move - Response: Updated game state after the move
Check if the game is completed (all tiles are in the correct order).
- Method:
GET
- URL:
/api/game/{gameId}/complete
- Response: Boolean indicating if the game is complete
To install and set up the project locally, follow these steps:
- Clone the repository to your local machine:
git clone https://github.com/bro256/puzzle-15-backend.git
- Navigate to the project directory:
cd puzzle-15-backend
- Build the project using Maven:
mvn clean install
- Run the project:
mvn spring-boot:run
- The API will be accessible at http://localhost:8080.
We welcome contributions from the community to improve the project.
Thank you for considering contributing to the project! Your contributions help make the API better for everyone.