tic-tac-toe-api
is an api service that exposes an endpoint that will always calculate the best move for a given a game state.
-
Prerequisites:
- ✔ go go1.16.6 darwin/amd64.
brew install golang
- ✔ go go1.16.6 darwin/amd64.
-
Running:
- ✔ Clone this project:
git clone https://github.com/cosbor11/tic-tac-toe-api.git
- ✔ Navigate to the root of the project
cd tic-tac-toe-api
- ✔ run
go build
to install the dependencies - ✔ run:
go run server.go
to launch the application on localhost:5500
- ✔ Clone this project:
-
User Interface:
- POST /next-move:
Example Request:
curl --location --request POST 'http://localhost:5500/next-move' \
--header 'Content-Type: application/json' \
--data-raw '{
"player": "O",
"moves": [{
"player": "X",
"cell": "A1"
},{
"player": "O",
"cell": "B3"
}]
}'
Example Response:
{
"player": "O",
"cell": "A2"
}
@author Chris Osborn