Skip to content

jaspreet21anand/bowling_game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BOWLING GAME

This repository opens up API for

  • starting a new bowling game which returns game_id
  • recording ball throws with pinfall_count and game_id as parameters
  • api to return current game state and score
  • Ruby version - ruby-2.6.3

  • Configuration - Rails 6.0.2 --api --postgresql

  • configure your database.yml for postgresql rake db:create rake db:migrate

  • Enpoints:

  1. Start New Game - POST /games
  • { "status": "success", "message": "New game started", "game_id": 37 }
  1. Add a Throw - POST /games/:game_id/throws accepts params { knocked_pins: 1 }
  • { "status": "success", "message": "Throw recorded successfully.", "knocked_pins": 1 }
  1. Get Game Score & Status - GET /games/:id
  •   "status": "success",
      "game": {
          "state": "open",
          "score": 6,
          "score_details": {
              "frames": [
                  {
                      "score": 6,
                      "state": "closed",
                      "throws": [
                          {
                              "knocked_pins": 1,
                              "knock_type": "play"
                          },
                          {
                              "knocked_pins": 5,
                              "knock_type": "play"
                          }
                      ]
                  },
                  {
                      "score": null,
                      "state": "closed",
                      "throws": [
                          {
                              "knocked_pins": 5,
                              "knock_type": "play"
                          },
                          {
                              "knocked_pins": 5,
                              "knock_type": "spare"
                          }
                      ]
                  }
              ]
          }
      }
    }```
    

About

This enables an API for keeping bowling game scores.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published