Skip to content

Instantly share code, notes, and snippets.

@illbzo1
illbzo1 / madlibs
Created October 30, 2011 17:30
Refactored Madlibs generator
def generate_mad_lib
puts "Bear with me. I'm going to need 16 singular nouns."
@nouns = []
16.times { @nouns << gets.chomp }
puts "Awesome, now I'm going to need 6 plural nouns."
@plural_nouns = []
6.times { @plural_nouns << gets.chomp }
puts "Ok, now let's collect some singular verbs. I'm looking for 7 of them."
@illbzo1
illbzo1 / madlib
Created October 29, 2011 00:32
Simple MadLibs generator
def prompt
print "> "
end
def generate_mad_lib
puts "Bear with me. I'm going to need 18 singular @nouns."
prompt;
@noun1 = gets.chomp()
@noun2 = gets.chomp()
@noun3 = gets.chomp()
@illbzo1
illbzo1 / Gothon_Game
Created October 27, 2011 00:13
Another text-based dungeon game
class Game
def initialize(start)
@quips = [
"You died. You kind of suck at this.",
"Nice job! You died again!",
"What a loser!",
"I have a small puppy that's better at this."
]
@start = start
@illbzo1
illbzo1 / The Tomb of Unfathomable Horror
Created October 16, 2011 21:50
Text-based Dungeon Adventure
# creates an empty array for the user's inventory
@inventory = []
# this is the command prompt method
def prompt()
print "Enter command > "
end
# shows a list of viable commands when a user enters "help" at the command prompt
def help()