Skip to content

Instantly share code, notes, and snippets.

@RyanSnodgrass
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save RyanSnodgrass/9919053 to your computer and use it in GitHub Desktop.

Select an option

Save RyanSnodgrass/9919053 to your computer and use it in GitHub Desktop.
pers_types = {extrovert: [{type: "PARTY'S LIKE AN ANIMAL"}, {type: "Gets out"}],
introvert: [{type: "Dwells in the basement"}, {type: "Stays at home"}]
}
pers_tally = 0
play_with_friend = 1
@users_hash = Hash.new
def gets_user_info
puts "first, tell me your name"
@name = gets.chomp
puts "now how old are you?"
@age = gets.chomp
puts "lastly, what's your sign?"
@sign = gets.chomp
@users_hash.merge!(@name => [{ userage: @age, usersign: @sign}])
end
questions = ["Do you feel energized being with others in a group setting?",
"Do you enjoy being the center of attention?",
"If you went to a party, would you mingle with everyone you could?",
"would your friends describe you as talkative?",
"do you enjoy meeting new people?",
"do you seem to care more about wealth, fame, and status more than your peers would?",
"Are your birthday parties usually big and extravagent?",
"do you take a lot of selfies?",
"do you find yourself at the night club atleast once a month?",
"lastly, is your clothing 'loud' and recognizable?"
]
while play_with_friend == 1
gets_user_info
puts @users_hash
puts "lets find your personality"
puts "please answer with a '1' for yes and '0' for no"
questions.each {
|x| puts x
begin
answer = Integer(gets.chomp)
rescue
puts "hey give only '1' or '0'"
retry
end
pers_tally += 1 if answer == 1
}
case pers_tally
when (0..3)
puts "you're the type that #{pers_types[:introvert][0][:type]}"
when (4..5)
puts "you're the type that #{pers_types[:introvert][1][:type]}"
when (6..7)
puts "you're the type that #{pers_types[:extrovert][1][:type]}"
when (8..10)
puts "you're the type that #{pers_types[:extrovert][0][:type]}"
end
puts "Do you have a friend who wants to play? put '1' for yes and '0' for no."
#play_with_friend = gets.chomp.to_i
begin
play_with_friend = Integer(gets.chomp)
rescue
puts "hey give only '1' or '0'"
retry
end
end
puts "have a good one"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment