Skip to content

Hannah Aurand #194

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
Changes from all commits
Commits
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
196 changes: 51 additions & 145 deletions capitals.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# an array of state hashes
states =[
{
puts "Learn the states!"

states = [ {
name: "Alabama",
capital: "Montgomery"
}, {
Expand All @@ -9,145 +9,51 @@
}, {
name: "Arizona",
capital: "Phoenix"
}, {
name: "Arkansas",
capital: "Little Rock"
}, {
name: "California",
capital: "Sacramento"
}, {
name: "Colorado",
capital: "Denver"
}, {
name: "Connecticut",
capital: "Hartford"
}, {
name: "Delaware",
capital: "Dover"
}, {
name: "Florida",
capital: "Tallahassee"
}, {
name: "Georgia",
capital: "Atlanta"
}, {
name: "Hawaii",
capital: "Honolulu"
}, {
name: "Idaho",
capital: "Boise"
}, {
name: "Illinois",
capital: "Springfield"
}, {
name: "Indiana",
capital: "Indianapolis"
}, {
name: "Iowa",
capital: "Des Moines"
}, {
name: "Kansas",
capital: "Topeka"
}, {
name: "Kentucky",
capital: "Frankfort"
}, {
name: "Louisiana",
capital: "Baton Rouge"
}, {
name: "Maine",
capital: "Augusta"
}, {
name: "Maryland",
capital: "Annapolis"
}, {
name: "Massachusetts",
capital: "Boston"
}, {
name: "Michigan",
capital: "Lansing"
}, {
name: "Minnesota",
capital: "St. Paul"
}, {
name: "Mississippi",
capital: "Jackson"
}, {
name: "Missouri",
capital: "Jefferson City"
}, {
name: "Montana",
capital: "Helena"
}, {
name: "Nebraska",
capital: "Lincoln"
}, {
name: "Nevada",
capital: "Carson City"
}, {
name: "New Hampshire",
capital: "Concord"
}, {
name: "New Jersey",
capital: "Trenton"
}, {
name: "New Mexico",
capital: "Santa Fe"
}, {
name: "New York",
capital: "Albany"
}, {
name: "North Carolina",
capital: "Raleigh"
}, {
name: "North Dakota",
capital: "Bismarck"
}, {
name: "Ohio",
capital: "Columbus"
}, {
name: "Oklahoma",
capital: "Oklahoma City"
}, {
name: "Oregon",
capital: "Salem"
}, {
name: "Pennsylvania",
capital: "Harrisburg"
}, {
name: "Rhode Island",
capital: "Providence"
}, {
name: "South Carolina",
capital: "Columbia"
}, {
name: "South Dakota",
capital: "Pierre"
}, {
name: "Tennessee",
capital: "Nashville"
}, {
name: "Texas",
capital: "Austin"
}, {
name: "Utah",
capital: "Salt Lake City"
}, {
name: "Vermont",
capital: "Montpelier"
}, {
name: "Virginia",
capital: "Richmond"
}, {
name: "Washington",
capital: "Olympia"
}, {
name: "West Virginia",
capital: "Charleston"
}, {
name: "Wisconsin",
capital: "Madison"
}, {
name: "Wyoming",
capital: "Cheyenne"
}]
}
].shuffle
#users = ["Alice", "Bob", "Carol"]
#index = 0
# while index < users.length
# puts users[index]
# index += 1
# end


#state = states[i]




i = 0
tally = 0
while i < states.length
#puts states[i][:name]
state = states[i][:name]
capital = states[i][:capital]
i += 1
puts "What is the capital of #{state}?"
user_answer = gets.chomp
if user_answer != capital
puts "Nope."
elsif user_answer = capital
tally += 1
end
puts tally
puts "Would you like to play again?"
user_input = gets.chomp
if user_input == "yes"

end
end







# ask them what the capital of any given state in the array is
#for each state in the states array, display it in the question "what is the capital of ${state}?"
# if they are wrong, tell them to try again
#if they are right, move on to the next state in the array