Class: Iching
Instance Method Summary collapse
Instance Method Details
#display ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/iching.rb', line 15 def display if Random.new.rand(1..20) > 1 puts hex_symbol, hex_name, hex_symbol(1), hex_name(1) else puts "A suffusion of yellow." end end |
#hex_name(hex = 0) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/iching.rb', line 23 def hex_name(hex = 0) bin_hex = '' if hex == 0 hex.each {|stick| bin_hex << binhex1_key[stick]} end if hex == 1 hex.each {|stick| bin_hex << binhex2_key[stick]} end bin_hex.reverse! return list[bin_hex] end |
#hex_symbol(hex = 0) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/iching.rb', line 35 def hex_symbol(hex = 0) symbol = '' if hex == 0 hex.each {|stick| symbol << hexagram1_key[stick] + "\n"} end if hex == 1 hex.each {|stick| symbol << hexagram2_key[stick] + "\n"} end return symbol end |