Gweaton / bowling-challenge

Calculate Scores for Ten Pin Bowling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bowling Challenge

A program to count and sum the scores of a bowling game for one player.

Alt text

Rules

A bowling game consists of 10 frames in which the player tries to knock down the 10 pins. In every frame the player can roll one or two times. The actual number depends on strikes and spares. The score of a frame is the number of knocked down pins plus bonuses for strikes and spares. After every frame the 10 pins are reset.

Strikes

The player has a strike if he knocks down all 10 pins with the first roll in a frame. The frame ends immediately (since there are no pins left for a second roll). The bonus for that frame is the number of pins knocked down by the next two rolls. That would be the next frame, unless the player rolls another strike.

Spares

The player has a spare if the knocks down all 10 pins with the two rolls of a frame. The bonus for that frame is the number of pins knocked down by the next roll (first roll of next frame).

10th frame

If the player rolls a strike or spare in the 10th frame they can roll the additional balls for the bonus. But they can never roll more than 3 balls in the 10th frame. The additional rolls only count for the bonus not for the regular frame count.

Gutter Game

A Gutter Game is when the player never hits a pin (20 zero scores).

Perfect Game

A Perfect Game is when the player rolls 12 strikes (10 regular strikes and 2 strikes for the bonus in the 10th frame). The Perfect Game scores 300 points.

Ten Pin Score Example

Installation instructions

  • Clone & download this repo
  • Navigate to the directory in your terminal and type open bowlingScorer.html to run the bowling score calculator.
  • For each input field in the table, enter the score for your most recent roll (currently only working for the first frame - the others work in the Developer Console). This will then automatically update the table for you.

Technologies

  • HTML
  • CSS
  • Javascript
  • JQuery v3.1.1
  • Jasmine

CI

We are running JSHint on our CI server - save yourself having to wait for a build to happen by linting your code on your machine first. Here are installations for most popular editors. Grab the .jshintrc from this repo and have better JS!

If you don't follow the usual Jasmine convention of having your tests in spec and your code in src, or you've built your code into a little app, CI will probably fail for you as we are doing sneaky things™ to make your tests run. However, there is a simple fix:

  1. Open up your .travis.yml
  2. On line 8, you will see where it looks for your code ('src/**/*.js') and your tests ('spec/**/*.js')
  3. Adjust these to point to the correct directories
  4. Done.

About

Calculate Scores for Ten Pin Bowling


Languages

Language:JavaScript 96.0%Language:HTML 3.8%Language:CSS 0.2%