Skip to content

Instantly share code, notes, and snippets.

@MelanieS
Created December 10, 2010 05:11
Show Gist options
  • Save MelanieS/735819 to your computer and use it in GitHub Desktop.
Save MelanieS/735819 to your computer and use it in GitHub Desktop.
q1 = 'When there is a need to correct someone, I am:
A: afraid to hurt their feelings.
B: quick to do it.' #A = feeling, B = thinking
q2 = 'I consider myself to be:
A: a realist.
B: an idealist.' #A = sensing, B = intuition
q3 = 'Clutter in my home:
A: bothers me.
B: is not something I notice.' #A = judging, B = perceiving
#q4 = 'i tend to:
# A: see the big picture
# B: focus on details' #A = intuition, B = sensing
q5 = 'i would classify myself as:
A: a social butterfly
B: a lone ranger' #A = extroversion, B = introversion
$introversion = 0
$extroversion = 0
$intuition = 0
$sensing = 0
$feeling = 0
$thinking = 0
$perceiving = 0
$judging = 0
def quizzing (question, type1, type2)
response = ''
puts 'Choose A or B:'
puts
while response != 'a' && response != 'b'
puts "#{question}"
response = gets.chomp.downcase
end
if response == 'a'
return type1
elsif response == 'b'
return type2
end
end
def calculate_type (type_match)
if type_match == 'introversion'
$introversion =+ 1
return $introversion
elsif type_match == 'extroversion'
$extroversion =+ 1
return $extroversion
elsif type_match == 'intuition'
$intuition =+ 1
return $intuition
elsif type_match == 'sensing'
$sensing =+ 1
return $sensing
elsif type_match == 'feeling'
$feeling =+ 1
return $feeling
elsif type_match == 'thinking'
$thinking =+ 1
return $thinking
elsif type_match == 'perceiving'
$perceiving =+ 1
return $perceiving
elsif type_match == 'judging'
$judging =+ 1
return $judging
end
end
type_match = quizzing(q1, 'feeling', 'thinking')
calculate_type(type_match)
type_match = quizzing(q2, 'sensing', 'intuition')
calculate_type(type_match)
type_match = quizzing(q3, 'judging', 'perceiving')
calculate_type(type_match)
#type_match = quizzing(q4, 'intuition', 'sensing')
#calculate_type(type_match)
type_match = quizzing(q5, 'extroversion', 'introversion')
calculate_type(type_match)
#puts $introversion.to_s + 'introversion'
#puts $extroversion.to_s + 'extroversion'
#puts $intuition.to_s + 'intuition'
#puts $sensing.to_s + 'sensing'
#puts $feeling.to_s + 'feeling'
#puts $thinking.to_s + 'thinking'
#puts $perceiving.to_s + 'perceiving'
#puts $judging.to_s + 'judging'
world = ''
information = ''
decisions = ''
structure = ''
if $introversion > $extroversion
world = 'I'
elsif $introversion < $extroversion
world = 'E'
else
world = 'Both I & E '
end
if $intuition > $sensing
information = 'N'
elsif $intuition < $sensing
information = 'S'
else
information = 'Both N & S, '
end
if $feeling > $thinking
decisions = 'F'
elsif $feeling < $thinking
decisions = 'T'
else
decisions = 'Both F & T, '
end
if $perceiving > $judging
structure = 'P'
elsif $perceiving < $judging
structure = 'J'
else
structure = 'Both P & J '
end
puts "Your type is #{world}#{information}#{decisions}#{structure}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment