This API calculates the maximum number of draws that could have occurred in a series of Go games played by three friends, given their points.
Follow these steps to set up and run the project locally:
- Ensure you have Node.js and npm installed. You can download them from Node.js
- Clone the repository: Run the followig code in your terminal
git clone https://github.com/anvithagowda098/go_game_api.git
- Navigate to the project directory:Run the followig code in your terminal
cd go-game-api
- Install dependencies:Run the followig code in your terminal
npm install
- Running the Server To start the server, run the following code in your terminal:
node index.js
You should see output indicating that the server is running: Server running at http://localhost:3000/
GET /:p1/:p2/:p3
p1
: Points of the first player (integer, 0-30, inclusive)p2
: Points of the second player (integer, 0-30, inclusive)p3
: Points of the third player (integer, 0-30, inclusive)Response
If the input is valid:{ "max_draws": <number of draws> }
Input: /0/0/0
Expected Output:
{
"max_draws": 0
}
Input: /1/1/2
Expected Output:
{
"max_draws": 2
}
Input: /3/4/5
Expected Output:
{
"max_draws": 6
}