Biorhythms: Difference between revisions

m
(Add Kotlin implementation)
 
(2 intermediate revisions by the same user not shown)
Line 837:
readln;
end.</syntaxhighlight>
=={{header|EasyLang}}==
 
[https://easylang.online/show/#cod=bVNNj6MwDL3nVzwxaNUpgnX4aMuB4x72tn+hkIwaCUgFYabsr185QNtZ9ULs9+zYfia1GdwlRIVAlnkWUxZTGQh1dnoFj2lMx1jKQLxhg8epHt0AZzrN5ziPbEJCkniD+Jj6Buo8Q4VIBIAZFfqpq/WwpaoQEjlz3SvugJQ59YorF27Qbhp6ZIcj9pgRg8/djAi7DhHKdyjzCZkuZ44I6bHAHp33S0RQnJRRkZFIhNM3N5q/GvnSvumNQx3eR2hNr7+MchdQ4ut39lOjINDGsiOJ7hyheHCSNvfDDn6uOCU4i9SDW85tDQLQmKFpNSgpVuCGqEK6uMm9So7Sy8j9ow6f8NPpjiuPq/M8oloW4xcZe7v2f8BzIj0SOeUHAm8ET7KzLxJxHWyDZuZGe/vFFlyIxrZIlh4b29qBv0/3c9QeMkkRr+P7Wi78X+fiWS++n+NZNLajh3RXVEzsMZoeu+zApsJPLvS+hvglsLqIcH0paCJWfZbNL8/C6ySWAT2dZgj+XObRNOc2QEn0jTwh+NVZZ2zPLJXf2CxD8Lt3um114yYfQKUQ/wA= Run it]
 
<syntaxhighlight>
birth$ = "1943-03-09"
date$ = "1972-07-11"
# date$ = substr timestr systime 1 10
#
func day d$ .
y = number substr d$ 1 4
m = number substr d$ 6 2
d = number substr d$ 9 2
return 367 * y - 7 * (y + (m + 9) div 12) div 4 + 275 * m div 9 + d - 730530
.
textsize 4
func init b$ d$ .
linewidth 0.2
move 50 0
line 50 100
move 0 50
line 100 50
for d = -20 to 20
move x 50
circle 0.5
x += 2.5
.
move 4 94
text b$
move 4 88
text d$
days = day date$ - day birth$
move 4 80
text days & " days"
return days
.
proc cycle now cyc t$ col . .
color col
move 4 cyc * 1.2 - 20
text t$
linewidth 0.5
for d = now - 20 to now + 20
p = 20 * sin (360 * d / cyc)
line x 50 + p
x += 2.5
.
.
days = init birth$ date$
cycle days 23 "Physical" 900
cycle days 28 "Emotional" 090
cycle days 33 "Intellectual" 009
</syntaxhighlight>
 
=={{header|Emacs Lisp}}==
For Emacs, it makes sense to implement this as an interactive command which is personalized to the user's birthdate and computes the biorhythm for today. So if you put this code into your .emacs file (note that the birthdate has to be in MDY order in Emacs!):
Line 858 ⟶ 911:
age: 25238 physical: 94% emotional: 78% intellectual: -97%
</pre>
 
=={{header|Factor}}==
<syntaxhighlight lang="factor">USING: calendar calendar.parser formatting io kernel math
1,983

edits