Giter VIP home page Giter VIP logo

bowling's Introduction

Bowling Challenge

In this exercise you're going to be challenged to write a program to simulate a game of bowling. When you're done you should be able to run an instance of your Game class and have it return an array of bowling scores, and a final total score, for a game of bowling.

Just in case it's been a while since you've last bowled, here is how you keep score:

  1. A game has 10 frames(rounds)
  2. For each frame a player has two chances to knock 10 pins down.
  3. The score for the frame is the total number of pins knocked down.
  4. A spare is when the player knocks down all 10 pins in two tries.
  • A player will receive a bonus for that frame plus however many pins they knock down in the next roll. ~EX: If the score is 10 (total num knocked down) plus a bonus of 5 (num of pins knocked down in the next roll) then the score for the previous frame would be 15.
  1. A strike is when a player knocks down all 10 pins in the first try.
  • The bonus in this situation is the value of the next two balls rolled
  1. In the 10th frame a player who rolls a spare or a strike is allowed to roll the extra balls.
  • There is a hard cap at three balls in the 10th frame though.

Before starting make sure you understand the nuances of the game studying this example of a game. Walk through each frame making sure the score makes sense as you understand the rolls.

bowling game frame

Purpose

This exercise is an object oriented exercise focusing on form. The goal isn't just to make your program work, but instead should focus on a step by step, TDD driven approach. Write your most basic test case first and slowly work your way up. The below releases should act as a guideline if you are having trouble getting started. There are many ways to attack this problem, and you should feel free to make your own design choices / classes. Every method you'll need is not listed. This challenge is meant to push your understanding and implementation of OOP concepts. You may also find yourself moving between releases (adding and removing attributes and behaviors) from classes as your understanding of the program develops.

Release 0 - Create A Frame Class

The Frame class will be in charge of holding the score for a single frame for a single player. So after our program runs, each player object will have ten frame objects. The frame should know if it is a spare or strike. What instance variables will you need to keep track of for each frame? What methods will you need to create?

Release 1 - Create a Player Class

The player class will keep track of the player's score through out the game. The player should hold frame objects. It should be able to iterate over the frames and calculate the current score.

Release 2 - Create the Game Class

The game class will be in charge of game logic. It should hold players, know what frame is currently being bowled and how many frames are left in the game. This is where you'll write your logic to simulate the game. What method or methods will you need to 'bowl' a frame? Your game class should have a method play that simulates a game and returns the scores for each player.

bowling's People

Contributors

jalletto avatar jyoung217 avatar karaajc avatar mic-j-lee avatar

Watchers

 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.