Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bowling challenge #1606

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

tomcarmichael
Copy link

No description provided.

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');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this part where you are catching the error.

points_array.forEach((points) => {
this.roll(points);
});
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a method, maybe?

game.js Outdated
if (this.frames[9].isStrike() && this.frames[8].isStrike()) {
this.frames[8].bonusPoints += bonusRollsArray[0];
};
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice part

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants