This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lottery1 = rand(10) | |
lottery2 = rand(10) | |
lottery3 = rand(10) | |
pick1 = 10 | |
pick2 = 10 | |
pick3 = 10 | |
numberMatch = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cats = ['Chip', 'Nilla'] | |
cats.push 'Mel the Cat' | |
answer = '' | |
puts 'KITTY CAT XMAS LIST MAKER' | |
puts 'Did you get any new cats this year?' | |
answer = gets.chomp.downcase | |
while answer == 'yes' | |
puts 'You got a new kitty!?! Name it:' | |
kitten = gets.chomp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
words = [] | |
puts 'I am The Sorter! Enter many words. Hit enter after each word. When you | |
are done entering words, hit enter on an empty line.' | |
input = gets.chomp | |
words.push input | |
while input != '' | |
input = gets.chomp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shoes.app do | |
para "Which is best?\n" | |
flow do | |
@cats = button "Cats" | |
@giraffes = button "Giraffes" | |
@rocks = button "Rocks" | |
end | |
@cats.click { image "http://icanhascheezburger.files.wordpress.com/2010/05/funny-pictures-cats-are-adrift.jpg" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hug | |
puts 'Wraps arms around' | |
end | |
def cookies | |
puts 'bakes cookies' | |
end | |
def massage | |
puts 'rubs back' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#A lethal dose of Aspirin is 500 mg/kg of body weight. | |
# 1kg = 2.2 pounds. | |
# 325 mg tablets. | |
puts 'What is your weight in pounds?' | |
weight_in_pounds = gets.to_f | |
weight_in_kilos = weight_in_pounds / 2.2 | |
puts weight_in_kilos.to_s + 'weight in kilos' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
player_score = 0 | |
computer_score = 0 | |
player_reroll = true | |
while player_score < 100 && computer_score < 100 | |
while player_reroll == true | |
puts 'Type roll to roll: ' | |
to_roll = gets.chomp | |
while to_roll != 'roll' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
card_names = ['ace', 'two', 'three', 'four', 'five', | |
'six', 'seven', 'eight', 'nine', 'ten', | |
'jack', 'queen', 'king'] | |
card_names = [*(card_names.map { |e| "#{e} of hearts" }), | |
*(card_names.map { |e| "#{e} of diamonds" }), | |
*(card_names.map { |e| "#{e} of spades" }), | |
*(card_names.map { |e| "#{e} of clubs" })] | |
card_values = [*(1..13)] * 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
words = ['banana', 'computer', 'rocks', 'giraffe', 'science'] | |
answer = '' | |
while answer != 'no' | |
#init try_count to 6 == number of body parts for hangman | |
try_count = 6 | |
random = rand(words.count) | |
game_word = words[random] | |
game_word = game_word.split(//) | |
guessed_word = ['-'] * game_word.count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
computer_dice = [] | |
player_dice = [] | |
count = 0 | |
die_count = 0 | |
match_count = 0 | |
computer_matches = [] | |
player_matches = [] | |
while count < 5 | |
throw = rand(6) |