Skip to content

Create random_menu.rb #43

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Create random_menu.rb #43

wants to merge 1 commit into from

Conversation

nkiruka
Copy link

@nkiruka nkiruka commented Aug 10, 2017

Random Menu

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
How did you store menu components? Why? Menu components were stored in an array. Each array stored a collection of items, instead of creating multiple variables. Additionally, if I ever wanted to add additional items, this will be easily accomplished with an array.
Could you have stored components using a different data structure? For example, if you used an Array could you have used a Hash? Yes, I could have used a hash but I think for this particular exercise an array is better suited. Since a hash is a "key-value pair", I will have to think through how to randomize the keys and values to avoid duplication.
Did you find yourself repeating the same code? Why did you have to do it that way? I may have repeated code but I feel I have additional code that could have been simplified. For instance, I used sample and delete for each array to randomize each data set and to remove each item from the array to ensure each menu list was unique. I tried using the shuffle method on each array first prior to using a loop and I still didn't get the results I expected. The shuffle method returned an array, but using shuffle.first worked but I didn't get a unique randomized list.
What type of loop did you use? Why did you choose that type? I used a "times" loop to generate the random menu and a "while" loop for the number of menus to be generated. The while loop was used to check if the user input was not greater than the array length. I compared the user input to one array(which may not be a great idea since other arrays could be more or less). I used a times loop since I didn't want to hard code the # of menus to generated and instead assigned a variable to user input that store # of menus to be generated.

@PilgrimMemoirs
Copy link

Random Menu

What We're Looking For

Feature Feedback
Random Menu of 10 items displayed in the terminal. ❗️ Almost - while if I enter 10, I can get 10 items back, however the inputs of each response are not being put into arrays to generate a random menu. As this code is, it will only display items as the user enters.
Generator pulls one random item from each array to create menu items. ❗️ Items are not pulled out randomly from an array.
Baseline
Readable code with consistent indentation. Mostly Good - there is one chunk of code that is does not need to be indented (lines 33-48)
Extras
For future projects, if adding optionals significantly changes the outcome of your code - comment out the original code that was written to meet requirements, and then work on a copypasta version. That way if you make significant changes and it ends up broken or not complete, we can at least more easily focus on the requirements you originally finished.
Code, as submitted, broke when I ran it. I noticed you had your arrays commented out, but the variable 'adjectives' was still being called in the code that was not commented out. Before submitting, make sure the run the code before to make sure it runs as expected.
Code, as submitted, broke when I ran it. I noticed you had your arrays commented out, but the variable 'adjectives' was still being called in the code that was not commented out. Before submitting, make sure the run the code before to make sure it runs as expected.
The current condition of this code does not meet expectations for this project. Please submit a version that meets only the requirements. If you need help or clarification with anything, please reach out to me via slack or email and we can discuss what is needed.

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