Open
Conversation
carolrs
reviewed
May 2, 2023
| roll(points) { | ||
| // check if frame has already ended | ||
| if (this.rolls.length == 2 || this.rolls.includes(10)) { | ||
| throw new Error('Tried to add points to a frame that is already over'); |
There was a problem hiding this comment.
I like this part where you are catching the error.
| points_array.forEach((points) => { | ||
| this.roll(points); | ||
| }); | ||
| } |
There was a problem hiding this comment.
Maybe to change this for the interface?
game.js
Outdated
| for(let i = 0; i < 10; i++) { | ||
| let frame = new frameClass(); | ||
| this.frames.push(frame); | ||
| }; |
game.js
Outdated
| if (this.frames[9].isStrike() && this.frames[8].isStrike()) { | ||
| this.frames[8].bonusPoints += bonusRollsArray[0]; | ||
| }; | ||
| }; |
There was a problem hiding this comment.
Hey Tom, I think your code is good, especially your tests. I believe you predicted a lot of things that could go wrong in the program in your tests, so you already threw exceptions for those cases.
I like that you've already created your frames at the beginning with 10, so you're sure you won't have a null number. That was pretty smart!
... supplied as default paramter to Game constructor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.