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
my_hash = cd.shelf {} |
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
bands[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
$letters = { | |
1000 => "M", | |
500 => "D", | |
100 => "C", | |
50 => "L", | |
10 => "X", | |
5 => "V", | |
1 => "I" | |
} |
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 convert_to_roman(arabic) | |
numeral = "" | |
number = arabic | |
$letters.each do |key, value| | |
numerals += value * (number / key) | |
end | |
end |
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 convert_to_roman(arabic) | |
numeral = "" | |
number = arabic | |
$letters.each do |key, value| | |
numerals += value * (number / key) | |
num -= key * (num/key) | |
end | |
end |
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
$modern_letters = { | |
"VIIII" => "IX", | |
"IIII" => "IV", | |
"LXXXX" => "XC", | |
"XXXX" => "XL", | |
"DCCCC" => "CM", | |
"CCCC" => "CD" | |
} |
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 convert_to_roman(arabic, options={}) | |
num = arabic | |
numeral = "" | |
$letters.each do |key,value| | |
numeral += value * (num/key) | |
num -= key * (num/key) | |
end | |
if options.has_key?(:modern) && options[:modern] == true | |
$modern_letters.each do |old_nums, new_nums| |
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 convert_to_roman() | |
options = {} | |
puts "Enter a number" | |
num = gets.chomp.to_i | |
puts "Modern numerals? (Y/N)" | |
result = gets.chomp | |
if | |
result == "Y" | |
options[:modern] = true | |
elsif |
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
$letters = { | |
1000 => "M", | |
500 => "D", | |
100 => "C", | |
50 => "L", | |
10 => "X", | |
5 => "V", | |
1 => "I" | |
} |
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 shuffle(array) | |
random_nums=[] | |
end |
OlderNewer