Skip to content
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

Offering Phoenix Mythical Creature to be Added to Ruby Exercises #136

Open
wants to merge 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2e14933
Add unicorn.rb
MelTravelz Dec 21, 2022
a74ba85
Add vampire.rb
MelTravelz Dec 21, 2022
0964a4d
Add dragon.rb
MelTravelz Dec 21, 2022
4632428
Add class files
MelTravelz Dec 21, 2022
ebb9550
Add hobbit.rb
MelTravelz Dec 21, 2022
ffd4651
Add pirate.rb
MelTravelz Dec 21, 2022
a20d309
Add wizard.rb
MelTravelz Dec 21, 2022
f0d5a40
Add data-types, strings
MelTravelz Dec 21, 2022
353435a
Add data-types, integers
MelTravelz Dec 21, 2022
227c3a2
Add half data-types, adv collections
MelTravelz Dec 22, 2022
94dbe94
Add reduce_pattern test
MelTravelz Dec 22, 2022
5374ba3
Add iteration map_pattern
MelTravelz Dec 22, 2022
3743f22
Add iteration max-min file
MelTravelz Dec 22, 2022
0688b6d
Add medusa methods
MelTravelz Dec 22, 2022
21147a5
Add werewolf.rb
MelTravelz Dec 22, 2022
d78be93
Add data-types, collections, adv nested methods finish
MelTravelz Dec 22, 2022
7e886c7
Fix small {} to [] error in comments
MelTravelz Dec 22, 2022
310dac6
Add enumerables map
MelTravelz Dec 23, 2022
ff1cefe
Add enumerables select
MelTravelz Dec 23, 2022
ff70473
Add enumerables half group_by
MelTravelz Dec 23, 2022
f58d55d
Add mythical creatures centaur
MelTravelz Dec 23, 2022
e3b7476
Add mythical creatures ogre setup
MelTravelz Dec 23, 2022
910e20b
Add mythical creatures ogre
MelTravelz Dec 23, 2022
db4c1b1
Add mythical creatures Lovisa
MelTravelz Dec 23, 2022
4c9731a
Add part direwolf
MelTravelz Dec 23, 2022
f548f52
Add mythical creatures direwolf
MelTravelz Dec 23, 2022
dbf9e5c
Create phoenix mythical creature
MelTravelz Dec 24, 2022
fe73682
Add more phoenix test ideas
MelTravelz Dec 24, 2022
e304ba0
Add phoenix test/methods but stuck now
MelTravelz Dec 24, 2022
8235243
Fix methods & tests with peer help - must add a few more tests
MelTravelz Dec 24, 2022
b518ddc
Finish Phoenix Mythical Creature
MelTravelz Dec 24, 2022
afb73b6
fix: Modify duplicate words Phoenix
MelTravelz Dec 25, 2022
9e6b05c
Update emotions last time Phoenix
MelTravelz Dec 25, 2022
83ab2a6
modify age Phoenix
MelTravelz Dec 25, 2022
8ec9abc
Add enumberable find
MelTravelz Dec 26, 2022
0aed563
fix: mythical creatures direwolf leaves method
MelTravelz Dec 26, 2022
c53a6fc
Add notes to make changes Phoenix
MelTravelz Dec 26, 2022
a1378e8
Add enumerables count, reject, sort_by
MelTravelz Dec 28, 2022
e142849
Add more enumerables
MelTravelz Dec 28, 2022
5f7eb32
Fix: Update Phoenix - final version
MelTravelz Dec 28, 2022
a738ee1
Add enumerables reduce_pattern
MelTravelz Dec 28, 2022
1e1c29d
Add enumerables any?
MelTravelz Dec 28, 2022
f7990f2
Add enumerables all? method
MelTravelz Dec 28, 2022
f0cafae
Add changes
MelTravelz Jan 29, 2023
9b5ddd9
Upate
MelTravelz Feb 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,63 +15,78 @@
RSpec.describe 'Advanced Nested Collections' do
it 'test 1' do
# EXAMPLE
employees = stores[:olive_garden][:employees]
# employees = stores[:olive_garden][:employees]

expected = ["Jeff", "Zach", "Samantha"]
expect(employees).to eq(expected)
# expected = ["Jeff", "Zach", "Samantha"]
expect(stores[:olive_garden][:employees]).to eq(["Jeff", "Zach", "Samantha"])
end

xit 'test 2' do
it 'test 2' do
# Find the ingredients for pancakes
pancake_ingredients = _____
# pancake_ingredients = _____

expected = ["Flour", "Eggs", "Milk", "Syrup"]
expect(pancake_ingredients).to eq(expected)
# expected = ["Flour", "Eggs", "Milk", "Syrup"]
expect(stores[:dennys][:dishes].first[:ingredients]).to eq(["Flour", "Eggs", "Milk", "Syrup"])
end

xit 'test 3' do
it 'test 3' do
# Find the price of risotto
risotto_price = ____
# risotto_price = ____

expect(risotto_price).to eq(12)
expect(stores[:olive_garden][:dishes].first[:price]).to eq(12)
end

xit 'test 4' do
it 'test 4' do
# Find the ingredients for a Big Mac
big_mac_ingredients = ____
# big_mac_ingredients = ____

expected = ['Bun','Hamburger','Ketchup','pickles']
expect(big_mac_ingredients).to eq(expected)
# expected = ['Bun','Hamburger','Ketchup','pickles']
expect(stores[:macdonalds][:dishes][0][:ingredients]).to eq(['Bun','Hamburger','Ketchup','pickles'])
end

xit 'test 5' do
it 'test 5' do
# Find a list of restaurants
store_names = ____
# store_names = ____

expected = [:olive_garden, :dennys, :macdonalds]
expect(store_names).to eq(expected)
# expected = [:olive_garden, :dennys, :macdonalds]
expect(stores.keys).to eq([:olive_garden, :dennys, :macdonalds])
end

xit 'test 6' do
it 'test 6' do
# Find dishes names for Olive Garden
dishes_names = ____
# dishes_names = ____

expect(dishes_names).to eq(['Risotto', 'Steak'])
list_of_dishes = stores[:olive_garden][:dishes].map do |dish_info|
dish_info[:name]
end

expect(list_of_dishes).to eq(['Risotto', 'Steak'])
end

xit 'test 7' do
it 'test 7' do
# Return a list of employees across
# all restaurants
employee_names = ____
# employee_names = ____

all_employees = stores.flat_map do |restaurant, info|
info[:employees]
end

# expected = ["Jeff", "Zach", "Samantha", "Bob", "Sue", "James", "Alvin", "Simon", "Theodore"]
expect(all_employees).to eq(["Jeff", "Zach", "Samantha", "Bob", "Sue", "James", "Alvin", "Simon", "Theodore"])
end


it 'test 8' do
# Return a list of all ingredients across all restaurants
# ingredients = ____

expected = ["Jeff", "Zach", "Samantha", "Bob", "Sue", "James", "Alvin", "Simon", "Theodore"]
expect(employee_names).to eq(expected)
ingredients = stores.flat_map do |restaurant, info|
info[:dishes].flat_map do |dish|
dish[:ingredients]
end
end

xit 'test 8' do
# Return a list of all ingredients
# across all restaurants
ingredients = ____

expected = [
"Rice",
Expand All @@ -96,17 +111,25 @@
expect(ingredients).to eq(expected)
end

xit 'test 9' do
it 'test 9' do
# Return the full menu price for Olive Garden
full_menu_price = ____
# full_menu_price = ____

full_menu_price = stores[:olive_garden][:dishes].map do |dish|
dish[:price]
end.sum

expect(full_menu_price).to eq(27)
end

xit 'test 10' do
it 'test 10' do
# Return the full menu for Olive Garden
# olive_garden_menu = _____
olive_garden_menu = {}

olive_garden_menu = _____
stores[:olive_garden][:dishes].select do |dish|
olive_garden_menu[dish[:name]] = {:name => dish[:name], :ingredients => dish[:ingredients], :price => dish[:price]}
end

expected = {
"Risotto" => {
Expand All @@ -123,9 +146,19 @@
expect(olive_garden_menu).to eq(expected)
end

xit 'test 11' do
it 'test 11' do
# Return a full menu across all restaurants
full_menu = ____
# full_menu = ____

full_menu = {}

stores.each do |restaurant, info|
info[:dishes].select do |dish|
full_menu[dish[:name]] = {:name => dish[:name], :ingredients => dish[:ingredients], :price => dish[:price]}
end
end
# Huy used <.map> twice to make the code "cleaner"


expected = {
"Risotto" => {
Expand Down Expand Up @@ -159,6 +192,7 @@
:price => 2
}
}

expect(full_menu).to eq(expected)
end
end
53 changes: 27 additions & 26 deletions data-types/ints_and_floats/spec/ints_and_floats_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,76 +4,77 @@
unlucky = 13
# Using the two variables defined above,
# add the lucky number and the unlucky number
sum = ________
expect(sum).to eq(20)
# sum = ________
expect(lucky + unlucky).to eq(20)
end

xit 'test 2' do
it 'test 2' do
lucky = 7
unlucky = 13
# Using the two variables defined above,
# subtract the unlucky from the lucky
difference = ________
expect(difference).to eq(-6)
# difference = ________
expect(lucky - unlucky).to eq(-6)
end

xit 'test 3' do
it 'test 3' do
lucky = 7
unlucky = 13
# Using the two variables defined above,
# divide unlucky by lucky
# NOTE: this is integer division
quotient = ________
expect(quotient).to eq(1)
# quotient = ________
expect(unlucky / lucky).to eq(1)
expect(unlucky.div(lucky)).to eq(1)
end

xit 'test 4' do
it 'test 4' do
lucky = 7
unlucky = 13
# Using the two variables defined above,
# divide unlucky by lucky
quotient = ________
expect(quotient).to eq(1.8571428571428572)
# quotient = ________
expect(unlucky.fdiv(lucky)).to eq(1.8571428571428572)
end

xit 'test 5' do
it 'test 5' do
lucky = 7
unlucky = 13
# Using the two variables defined above,
# find the remainder of the unlucky divided by the lucky
remainder = ____________
expect(remainder).to eq(6)
# remainder = ____________
expect(unlucky.remainder(lucky)).to eq(6)
end

xit 'test 6' do
it 'test 6' do
lucky = 7
# Using the variable defined above,
# find out if the lucky number is even
even = _________
expect(even).to eq(false)
# even = _________
expect(lucky.even?).to eq(false)
end

xit 'test 7' do
it 'test 7' do
pi = 3.14
# Using the variable defined above,
# round the number to the nearest whole number
rounded = _________
expect(rounded).to eq(3)
# rounded = _________
expect(pi.round).to eq(3)
end

xit 'test 8' do
it 'test 8' do
pi = 3.14
# Using the variable defined above,
# round the number to one decimal place
rounded = _________
expect(rounded).to eq(3.1)
# rounded = _________
expect(pi.round(1)).to eq(3.1)
end

xit 'test 9' do
it 'test 9' do
pi = 3.14
# Using the variable defined above,
# round the number to the next highest whole number
rounded = _________
expect(rounded).to eq(4)
# rounded = _________
expect(pi.ceil).to eq(4)
end
end
Loading