forked from AdaGold/js-scrabble
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Queues - Kayla Kubicke - js-scrabble #43
Open
ghost
wants to merge
26
commits into
Ada-C7:master
Choose a base branch
from
unknown repository
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
A word score's is calculated based on individual letters.
Scrabble word returns a score.
An array can be passed through a function and words are sorted based on their individual score.
In the simple case that the last word is the highest scoring, that word is returned. This function runs before the others to avoid running through unnecessary operations.
If multiple words have the same high earning score, an array collection is created. This array can be used to evaluate the length of the highest earning words.
A winning word can be chosen among other high earning words. The first 7 letter word is automatically the winner. If none of the words are 7 letters, the shortest word with the lowest index is chosen.
Highest score
Player object has a name, an array that will contain any words they play, and creates a new Scrabble object so that prototype functions can be called on either a word or an array of words.
Added prototype function that adds an individual word to word collection array. Removed notes and cleaned up scrabble.js.
Prototype function totalScore grabs an array of words, calculates the total score, and returns the total score.
Prototype function hasWon returns true or false based on player's score. Prototype function play returns false if a player has already won the game.
Playerobject
Worked with Noam to reduce amount of code in score function.
Reduced amount of code used to calculate the highest scoring word.
Hsfrefactor
Player fix
Removed sort loop from highestScoreFrom as it was unnecessary. Removed initial value from reduce loop in highestScoreFrom because it will grab the first element as it's initial value. Added rules and changed variable names to increase readability. Cleaned up logic. Fixed highestScoreFrom bug; first 7 letter word will be returned.
JS ScrabbleWhat We're Looking For
|
Reintroduced 'i' into regular expressions based on Noam's suggestions. (I misunderstood their purpose.) First shortest word with the highest score is returned in cases where the winning word is not seven characters long and multiple words have the same length and score.
Fixed two bugs.
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.
JS Scrabble
Congratulations! You're submitting your assignment!
Comprehension Questions