-
Notifications
You must be signed in to change notification settings - Fork 10
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
hw 4, hopefully meets all requirements & bonuses #7
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sad3xoxo Great job with the rock-scissor-paper game and implementing the additional features!! ✨ 💯 also, great use of breaking your code into functional parts.
const n = winnerList.length - 1 | ||
// grab the last 3 winners from the winnerList | ||
const one = winnerList[n] | ||
const two = winnerList[n - 1] | ||
const three = winnerList[n - 2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sad3xoxo interesting take on getting 3 consecutive wins. another approach could be to increment a consecutive win variable for human and computer and it resets to zero when the other player scores and does not reach 3 consecutive wins. it saves memory because the winnerList
never reset and it stores items even after a final winner. In any case, great job adding the additional features to the game!!! 👍
updateScore(winnerList[n]) | ||
updateScore(winnerList[n]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sad3xoxo could have also passed a 1 or 2 depending on the conditional statement and whether to add bonus points. it still works!
} | ||
} | ||
|
||
function updateRoundScore (winner) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already know it's super messy, but still looking forward to your feedback. :)