Giter VIP home page Giter VIP logo

bowling-challenge's Introduction

Bowling Challenge

How to play:

In the Terminal:

$ git clone [email protected]:nenoch/bowling-challenge.git
$ cd bowling-challenge
$ open SpecRunner.html

- Right click on the page > Inspect > Dev Tools > Console

In console:
$ var game = new Game()
$ game.pinsKnockedDown(4)

- Enter number of pins till the end of the Game. You'll be able to see scores and bonuses.

HAVE FUN!

Travis CI Status Budge: Build Status

  • WIP: Working on 10th frame features, refactoring and implementing jQuery interface.

User Stories

As a bowling player
so that I can keep record of the pins I knocked down in a frame
I want to be able to enter their number after each roll.

As a bowling player
so that I can keep record of my score
I want to see my score on the screen.

As a bowling player
so that I don't have to calculate bonuses
I want to see my score inclusive of strikes and spares.

As a bowling player
so that I know when the game ends
I want to be notified of the end of the game and see my final score.

Task:

Count and sum the scores of a bowling game for one player (in JavaScript).

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.

As usual please start by

  • Forking this repo

  • Finally submit a pull request before Monday week at 9am with your solution or partial solution. However much or little amount of code you wrote please please please submit a pull request before Monday week at 9am. And since next week is lab week you have a full extra week to work on this.

Optional Extra

Create a nice interactive animated interface with jQuery.

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.

10, 10, 10 in the 10th frame gives 30 points (10 points for the regular first strike and 20 points for the bonus).
1, 9, 10 in the 10th frame gives 20 points (10 points for the regular spare and 10 points for the bonus).

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.

In the image below you can find some score examples.

More about ten pin bowling here: http://en.wikipedia.org/wiki/Ten-pin_bowling

Ten Pin Score Example

Code Review

In code review we'll be hoping to see:

  • All tests passing
  • The code is elegant: every class has a clear responsibility, methods are short etc.

Reviewers will potentially be using this code review rubric. Note that referring to this rubric in advance may make the challenge somewhat easier. You should be the judge of how much challenge you want.

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.

bowling-challenge's People

Contributors

tansaku avatar nenoch avatar gypsydave5 avatar spike01 avatar ptolemybarnes avatar roidriscoll avatar anitacanita avatar maryrosecook avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.