Skip to content

Instantly share code, notes, and snippets.

@chrisclc
Created October 15, 2020 15:21
Show Gist options
  • Save chrisclc/475204c83989005842a291b6381b4b04 to your computer and use it in GitHub Desktop.
Save chrisclc/475204c83989005842a291b6381b4b04 to your computer and use it in GitHub Desktop.
# Each player starts with the same basic stats.
player = { strength: 10, dexterity: 10, charisma: 10, stamina: 10 }
# Then the player picks a character class and gets an upgrade accordingly.
character_classes = {
warrior: { strength: 20 },
thief: { dexterity: 20 },
scout: { stamina: 20 },
mage: { charisma: 20 }
}
puts 'Please type your class (warrior, thief, scout, mage):'
input = gets.chomp.downcase.to_sym
player.merge!(character_classes[input])
puts 'Your character stats:'
puts player
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment