Nethack utilities
Usage
Time/Date operations
require 'time' # for Time.parse
require 'date'
require 'nethack_utils'
-
Friday 13th test
time = Time.parse('2009-03-13T00:00:00Z') time.friday_13th? #=> true date = Date.parse('2009-03-13') date.friday_13th? #=> true
-
Phase of the Moon test
time = Time.parse('2009-03-13T00:00:00Z') time.full_moon? #=> true date = Date.parse('2009-03-27') date.new_moon? #=> true
Rumor/Fortune cookies
require 'nethack_utils'
puts NethackUtils::Rumor.rumor #=> a true or false rumor
puts NethackUtils::Rumor.rumor(1) #=> a true rumor
puts NethackUtils::Rumor.rumor(0) #=> a false rumor