-
Notifications
You must be signed in to change notification settings - Fork 112
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
Sharks - Jeannie #111
base: main
Are you sure you want to change the base?
Sharks - Jeannie #111
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.
well done, Jeannie! I added a few comments about syntax and a suggestion to help with efficiency. Other than that, it looks good!
} else { | ||
playerHand.push(randomCharacter); | ||
LETTER_POOL[randomCharacter] -= 1; | ||
alphabet.replace(randomCharacter, ''); |
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.
love this idea! One thing I would suggest is turning alphabet
into an array instead of a string. That way when we change the index position's value to an empty string, we aren't creating a whole new copy of the data structure the way replace
is doing.
Each time we call replace
it has to make a new copy of the string.
}; | ||
|
||
|
||
export const usesAvailableLetters = (input, lettersInHand) => { |
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.
👍 very interesting approach!
} if (word.length >= 7) { | ||
score += 8; | ||
} |
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 think standard practice is to have the if statement start on its own line. I only ever see a conditional on the same line as a closing curly brace is with else
} if (word.length >= 7) { | |
score += 8; | |
} | |
} | |
if (word.length >= 7) { | |
score += 8; | |
} |
@@ -1,15 +1,157 @@ | |||
|
|||
const score_chart = { |
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.
oop careful! use camel case in JavaScript:
const score_chart = { | |
const scoreChart = { |
let score_list = []; | ||
let max_score = 0; | ||
let winning_word = ""; |
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.
let score_list = []; | |
let max_score = 0; | |
let winning_word = ""; | |
let scoreList = []; | |
let maxScore = 0; | |
let winningWord = ""; |
if (item["score"] === max_score && item["word"].length === 10) { | ||
winner = item; | ||
return winner; | ||
} else if (item["score"] === max_score && item["word"].length < winning_word.length) { |
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.
} else if (item["score"] === max_score && item["word"].length < winning_word.length) { | |
} | |
else if (item["score"] === max_score && item["word"].length < winning_word.length) { |
}; | ||
|
||
|
||
export const highestScoreFrom = (words) => { |
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.
👍
No description provided.