The TicTacToe Api
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- Docker >= v17.05
- php >= 7.2
git clone [email protected]:andreluizmachado/tictactoe-api.git
cd tictactoe-api
chmod -R 0777 storage/ #only in development env
cp .env.example .env
./bin/run-development.sh up --build
Resource to take the next bot play based on the given board.
Request:
POST http://localhost:8080/api/v1/bots/x/play
Header Content-Type: application/json
Content-Type: application/json
{
"previousPlays":[
{
"line":1,
"column":1
}
]
}
Response:
200 OK
{
"column": 1,
"line": 2
}
Resource to take the game status in the board.
Request:
POST http://localhost:8080/api/v1/boards
Header Content-Type: application/json
Content-Type: application/json
{
"x":{
"previousPlays":[
{
"line":1,
"column":1
},
{
"line":1,
"column":2
}
],
"nextPlay":{
"line":1,
"column":3
}
},
"o":{
"previousPlays":[
{
"line":2,
"column":1
},
{
"line":3,
"column":1
}
],
"nextPlay":null
}
}
Response when the game has not ended yet:
200 OK
{"status":"Game Running","winner":""}
Response when the game ends with a winner:
200 Ok
{"status":"Game Over","winner":"x"}
Response when the game ends in a draw:
200 Ok
{"status":"Game Over","winner":""}
The following command will perform unit and integration tests
./bin/run-testing.sh