From 1ee1b22070c908fa05b5f78a61c564faebf7b752 Mon Sep 17 00:00:00 2001 From: Samir70 Date: Fri, 24 Feb 2023 09:11:55 +0000 Subject: [PATCH] add example of usage/make clearer UI is optional --- README.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9d4306925c..3ab1bbc301 100644 --- a/README.md +++ b/README.md @@ -9,16 +9,33 @@ Bowling Challenge ## The Task -**THIS IS NOT A BOWLING GAME, IT IS A BOWLING SCORECARD. DO NOT GENERATE RANDOM ROLLS. THE USER INPUTS THE ROLLS.** +**THIS IS NOT A BOWLING GAME, IT IS A BOWLING SCORECARD. DO NOT GENERATE RANDOM ROLLS. AN ACTUAL USER INTERFACE IS OPTIONAL** -Count and sum the scores of a bowling game for one player (in JavaScript). +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. +Start by looking in detail at the scoring in the examples below. + +An example of how your code might be used could be: + +```javaScript +let scorecard = new Scorecard() +scorecard.addRoll(5) +scorecard.calculateScore() // returns 5 +scorecard.addFrame([3, 5]) // returns "Please finish the current frame [5, ?]" +scorecard.addRoll(2) +scorecard.addFrame([3, 5]) +scorecard.calculateScore() // returns 15 +scorecard.showScore() // [[5, 2], [3, 5]] +``` + As usual please start by * Forking this repo +* Using test-driven development (if you decide to write a user interface, then make sure you have looked at the chapters on mocking). + * 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. ___STRONG HINT, IGNORE AT YOUR PERIL:___ Bowling is a deceptively complex game. Careful thought and thorough diagramming — both before and throughout — will save you literal hours of your life.