A API for build web apps or mobile app where your only has that implement an UI(and Rest API, obviously).
Build a API with the logic game Minesweeper.
- Project owner: @Jesús Millán
- Users: Any person that want create an web app or mobile app where only should implement an interface interactive for the game.0
- Open-source community: Any person that want use this repository with education purposes.
- When a cell with no adjacent mines is revealed, all adjacent squares will be revealed (and repeat)
- Ability to 'flag' a cell with a question mark or red flag
- Detect when game is over
- Dont continue in the game if the game is over
- The data game should be persistence for each user
- Ability to start a new game and preserve/resume the old ones
- Ability to select the game parameters: number of rows, columns and mines.
- The total mines is between 1 and 1/3 of the cells
- Show the all mines when the game is over
- Dont count time game
- Dont init automatic game when the last game is over
- Dont show the score game
{
"board": [
["H", "H", "H", "1", "0"],
["Q", "H", "R", "1", "0"],
["H", "H", "2", "1", "0"],
["H", "R", "1", "0", "0"],
["1", "H", "1", "0", "0"]
],
"msg": "A generic message",
}
What's is the mean the letters?
- H: Hide
- Q: A question flag
- R: A red flag
- 0..8: The number of mines around
{
"error" : {
"msg": "This is a generic info about the error",
}
}
Create a new game for a user
Path: /v1/games/
Headers: Authorization: {username}
Body:
{
"rows": 10, // Integer: Rows of board
"cols": 10, // Integer: Cols of board
"mines": 10, // Integer: Mines in the board. The total mines should be less that (1/3)*rows*cols
}
Active o disable the flag in any cell
Path: /v1/flags/
Headers: Authorization: {username}
Body:
{
"x": 10, // Integer:
"y": 10, // Integer:
"type": 10, // "R" for red flag or "Q" for question flag
}
Explorer a cell and discover if is a mine or not
Path: /v1/explorer/
Headers: Authorization: {username}
Body:
{
"x": 10, // Integer:
"y": 10, // Integer:
}
- Install docker and docker-compose
docker-compose up --build