Skip to content

Water - Mackenzie #34

Open
mvlofthus wants to merge 7 commits into
Ada-C14:masterfrom
mvlofthus:master
Open

Water - Mackenzie #34
mvlofthus wants to merge 7 commits into
Ada-C14:masterfrom
mvlofthus:master

Conversation

@mvlofthus

Copy link
Copy Markdown

Assignment Submission: JS Adagrams

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Prompt Response
What patterns were you able to use from your Ruby knowledge to apply to JavaScript? for loops/if statements, pushing into arrays
Did you need to use different strategies to find information online about JavaScript than you would for Ruby? the lack of built in methods made this more difficult to write cleanly or simply. I had to write code to define the max and min values and couldn't use methods like .find, which were key to drying up our original code.
What was something you needed to do independent research on for this project? What did you learn? max and min values were something I had to look up and I was unclear on how hashes worked in js. I also had to look up how to randomize selected elements to fill the hand and delete elements out of the duplicated hand.
What was a challenge you were able to overcome on this assignment? I found solutions for all the problems I faced which was great. there are answers available, even if it requires changing the plan. the most difficult section for me was loading the letter pool and finding ties (I'm consistent at least, these were the hardest sections in our original ruby submission too!). for finding ties, the Math.min.apply(null,[..array]) was helpful. I used this to determine shortest word and the .max equivalent to determine scores with tied words. I still feel that I had to loop through more than I wanted and have a feeling there are considerably dry-er ways to do this but I don't know what they are yet
What has been interesting and positive about learning a new programming language? the overall logic holds up which is nice, loops and if statements are consistent between them as well as arrays and hashes, and it seems like there are some cool ways to access information. it's going a little faster than the learning process for ruby with the shared components.
What is something to focus on your learnings in JavaScript in the next week? I'm really struggling with understanding the capabilities and new rules js has. that was really tough for me with ruby too and getting through the foundational stage feels about as painful as it did with ruby. I need to use all the available resources - i've found those supplemental links to be really helpful.

…, outside of having hard copied the built array into an element of the Adagrams object
…ing and returned word instead of hash first go around. still feels overly complicated, but without built in methods, i'm feeling I have to define every variable. pushing winners into an array and returning the first entry was definitely much cleaner than returning winner up through multiple nested functions

@dHelmgren dHelmgren left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

JS Adagrams

Major Learning Goals/Code Review

Criteria yes/no, and optionally any details/lines of code to reference
Correctly uses variables, and only uses const and let variables. The program prefers const variables. The program never uses var. ✔️
Practices best-practices in JavaScript syntax. There are semi-colons at the end of most lines that need semi-colons. Variables and functions are named with camelCase. ✔️
Correctly creates and calls functions within an object with proper syntax (parameters, return statements, etc.) ✔️
Uses correct syntax for conditional logic and iteration ✔️
Practices git with at least 3 small commits and meaningful commit messages ✔️
Utilizes unit tests to verify code; tests can run using the command $ npm test test/adagrams.test.js and we see test successes and/or failures ✔️

Functional Requirements

Functional Requirement yes/no
For the drawLetters function, there is an appropriate data structure to store the letter distribution. (You are more likely to draw an 'E' than an 'X'.)
Utilizes unit tests to verify code; all tests for drawLetters and usesAvailableLetters pass ✔️
Utilizes unit tests to verify code; all tests for scoreWord pass ✔️
Utilizes unit tests to verify code; all tests for highestScoreFrom pass ✔️

Overall Feedback

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 5+ in Code Review && 3+ in Functional Requirements ✔️
Yellow (Approaches Standards) 4+ in Code Review && 2+ in Functional Requirements, or the instructor judges that this project needs special attention
Red (Not at Standard) 0-3 in Code Review or 0,1 in Functional Reqs, or assignment is breaking/doesn’t run with less than 5 minutes of debugging, or the instructor judges that this project needs special attention

Comment thread src/adagrams.js
Comment on lines +2 to +3
alphabet: ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'],
quantities: [9,2,2,4,12,2,3,2,9,1,1,4,2,6,8,2,1,6,4,6,4,2,2,1,2,1],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if you're going to do this, it's probably better just to store it in an object instead, because that way you can much more quickly tell which letter is associated with what value.

If I told you the letter pool needed 4 more Ms, how annoying would it be to change?

Comment thread src/adagrams.js
Comment on lines +26 to +28
for (let i=0; i < 10; i++) {
hand.push(letters[Math.floor(Math.random() * letters.length)]);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is a good start, but because you aren't modifying the pool after each draw, it's possible (however unlikely) that a player ends up with a hand made entirely of 'Q's.

Look up the splice function.

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