mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
matz - biorhythm.rb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b2d7eaec50
commit
ed474caef1
2 changed files with 10 additions and 28 deletions
17
mkconfig.rb
17
mkconfig.rb
|
@ -83,22 +83,7 @@ end
|
||||||
print v_fast, v_others
|
print v_fast, v_others
|
||||||
print <<EOS
|
print <<EOS
|
||||||
CONFIG["compile_dir"] = "#{Dir.pwd}"
|
CONFIG["compile_dir"] = "#{Dir.pwd}"
|
||||||
MAKEFILE_CONFIG = {}
|
MAKEFILE_CONFIG = CONFIG.dup
|
||||||
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
|
|
||||||
def Config::expand(val)
|
|
||||||
val.gsub!(/\\$\\(([^()]+)\\)/) do |var|
|
|
||||||
key = $1
|
|
||||||
if CONFIG.key? key
|
|
||||||
"\#{Config::expand(CONFIG[\\\"\#{key}\\\"])}"
|
|
||||||
else
|
|
||||||
var
|
|
||||||
end
|
|
||||||
end
|
|
||||||
val
|
|
||||||
end
|
|
||||||
CONFIG.each_value do |val|
|
|
||||||
Config::expand(val)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
EOS
|
EOS
|
||||||
config.close
|
config.close
|
||||||
|
|
|
@ -50,7 +50,7 @@ def printHeader(y, m, d, p, w)
|
||||||
end
|
end
|
||||||
|
|
||||||
def getPosition(z)
|
def getPosition(z)
|
||||||
pi = 3.14159265
|
pi = Math::PI
|
||||||
phys = (50.0 * (1.0 + sin((z / 23.0 - (z / 23)) * 360.0 * pi / 180.0))).to_i
|
phys = (50.0 * (1.0 + sin((z / 23.0 - (z / 23)) * 360.0 * pi / 180.0))).to_i
|
||||||
emot = (50.0 * (1.0 + sin((z / 28.0 - (z / 28)) * 360.0 * pi / 180.0))).to_i
|
emot = (50.0 * (1.0 + sin((z / 28.0 - (z / 28)) * 360.0 * pi / 180.0))).to_i
|
||||||
geist =(50.0 * (1.0 + sin((z / 33.0 - (z / 33)) * 360.0 * pi / 180.0))).to_i
|
geist =(50.0 * (1.0 + sin((z / 33.0 - (z / 33)) * 360.0 * pi / 180.0))).to_i
|
||||||
|
@ -62,7 +62,7 @@ def parsedate(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def name_of_week(date)
|
def name_of_week(date)
|
||||||
Date::DAYNAMES[(date.jd + 1) % 7]
|
Date::DAYNAMES[date.wday]
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -71,8 +71,7 @@ end
|
||||||
parseArgs(0, nil, "vg", "D:", "sdate", "date:", "birthday:", "days:")
|
parseArgs(0, nil, "vg", "D:", "sdate", "date:", "birthday:", "days:")
|
||||||
|
|
||||||
if $OPT_D
|
if $OPT_D
|
||||||
now = Time.now
|
dd = Date.today
|
||||||
dd = Date.new(now.year, now.month, now.day)
|
|
||||||
bd = Date.new(*parsedate($OPT_D))
|
bd = Date.new(*parsedate($OPT_D))
|
||||||
ausgabeart = "g"
|
ausgabeart = "g"
|
||||||
else
|
else
|
||||||
|
@ -90,8 +89,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
if $OPT_sdate
|
if $OPT_sdate
|
||||||
now = Time.now
|
dd = Date.today
|
||||||
dd = Date.new(now.year, now.month, now.day)
|
|
||||||
elsif $OPT_date
|
elsif $OPT_date
|
||||||
dd = Date.new(*parsedate($OPT_date))
|
dd = Date.new(*parsedate($OPT_date))
|
||||||
else
|
else
|
||||||
|
@ -101,8 +99,7 @@ else
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if !dd
|
if !dd
|
||||||
now = Time.now
|
dd = Date.today
|
||||||
dd = Date.new(now.year, now.month, now.day)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if $OPT_v
|
if $OPT_v
|
||||||
|
@ -115,10 +112,10 @@ else
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (ausgabeart == "v")
|
if (ausgabeart == "v")
|
||||||
printHeader(bd.year, bd.month, bd.day, dd.jd - bd.jd, name_of_week(bd))
|
printHeader(bd.year, bd.month, bd.day, dd - bd, name_of_week(bd))
|
||||||
print "\n"
|
print "\n"
|
||||||
|
|
||||||
phys, emot, geist = getPosition(dd.jd - bd.jd)
|
phys, emot, geist = getPosition(dd - bd)
|
||||||
printf "Biorhythm: %04d.%02d.%02d\n", dd.year, dd.month, dd.day
|
printf "Biorhythm: %04d.%02d.%02d\n", dd.year, dd.month, dd.day
|
||||||
printf "Physical: %d%%\n", phys
|
printf "Physical: %d%%\n", phys
|
||||||
printf "Emotional: %d%%\n", emot
|
printf "Emotional: %d%%\n", emot
|
||||||
|
@ -139,13 +136,13 @@ else
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
printHeader(bd.year, bd.month, bd.day, dd.jd - bd.jd, name_of_week(bd))
|
printHeader(bd.year, bd.month, bd.day, dd - bd, name_of_week(bd))
|
||||||
print " P=physical, E=emotional, M=mental\n"
|
print " P=physical, E=emotional, M=mental\n"
|
||||||
print " -------------------------+-------------------------\n"
|
print " -------------------------+-------------------------\n"
|
||||||
print " Bad Condition | Good Condition\n"
|
print " Bad Condition | Good Condition\n"
|
||||||
print " -------------------------+-------------------------\n"
|
print " -------------------------+-------------------------\n"
|
||||||
|
|
||||||
for z in (dd.jd - bd.jd)..(dd.jd - bd.jd + display_period)
|
for z in (dd - bd)..(dd - bd + display_period)
|
||||||
phys, emot, geist = getPosition(z)
|
phys, emot, geist = getPosition(z)
|
||||||
|
|
||||||
printf "%04d.%02d.%02d : ", dd.year, dd.month, dd.day
|
printf "%04d.%02d.%02d : ", dd.year, dd.month, dd.day
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue