Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
110
Task/Biorhythms/FutureBasic/biorhythms.basic
Normal file
110
Task/Biorhythms/FutureBasic/biorhythms.basic
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
Biorhythms task for Rosetta Code
|
||||
https://rosettacode.org/wiki/Biorhythms
|
||||
|
||||
Translated from FreeBasic to FutureBasic
|
||||
Rich Love May 24, 2024
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
local fn Gregorian(db As str255) As short
|
||||
short M, Y, D
|
||||
Y = val(Left$(db,4)) : M = Val(Mid$(db,6,2)) : D = Val(Right$(db,2))
|
||||
short N = (M+9) - Int((M+9)/12) * 12
|
||||
short W = Y - Int(N/10)
|
||||
short G = 365 * W + Int(W/4) - Int(W/100) + Int(W/400)
|
||||
G += Int((N*306+5)/10)+(D-1)
|
||||
end fn = G
|
||||
|
||||
|
||||
void local fn Biorhythm(Birthdate As str255, Targetdate As str255)
|
||||
|
||||
str255 TextArray(4,2)
|
||||
TextArray(0,0) = "up and rising"
|
||||
TextArray(1,0) = "up but falling"
|
||||
TextArray(2,0) = "down and falling"
|
||||
TextArray(3,0) = "down but rising"
|
||||
TextArray(0,1) = "peak"
|
||||
TextArray(1,1) = "transition"
|
||||
TextArray(2,1) = "valley"
|
||||
TextArray(3,1) = "transition"
|
||||
|
||||
|
||||
short DaysBetween = fn Gregorian(Targetdate) - fn Gregorian(Birthdate) + 1
|
||||
short positionP = DaysBetween Mod 23
|
||||
short positionE = DaysBetween Mod 28
|
||||
short positionM = DaysBetween Mod 33
|
||||
short quadrantP = Int(4 * positionP / 23)
|
||||
short quadrantE = Int(4 * positionE / 28)
|
||||
short quadrantM = Int(4 * positionM / 33)
|
||||
short percentageP = Fix(100 * Sin(2 * (pi * positionP) / 23))
|
||||
short percentageE = Fix(100 * Sin(2 * (pi * positionE) / 28))
|
||||
short percentageM = Fix(100 * Sin(2 * (pi * positionM) / 33))
|
||||
|
||||
str255 textP, textE, textM, Header1Text, Header2Text
|
||||
|
||||
|
||||
Select Case percentageP
|
||||
Case > 95
|
||||
textP = "Physical day " + str$(positionP) + " : " + "peak"
|
||||
Case < -95
|
||||
textP = "Physical day " + str$(positionP) + " : " + "valley"
|
||||
Case -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5
|
||||
textP = "Physical day " + str$(positionP) + " : " + "critical transition"
|
||||
Case Else
|
||||
textP = "Physical day " + str$(positionP) + " : " + str$(percentageP) + "% (" + TextArray(quadrantP,0) + ")"
|
||||
End Select
|
||||
|
||||
Select Case percentageE
|
||||
Case > 95
|
||||
textE = "Emotional day " + STR$(positionE) + " : " + "peak"
|
||||
Case < -95
|
||||
textE = "Emotional day " + STR$(positionE) + " : " + "valley"
|
||||
Case -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5
|
||||
textE = "Emotional day " + STR$(positionE) + " : " + "critical transition"
|
||||
Case Else
|
||||
textE = "Emotional day " + STR$(positionE) + " : " + str$(percentageE) + "% (" + TextArray(quadrantE,0) + ")"
|
||||
End Select
|
||||
|
||||
Select Case percentageM
|
||||
Case > 95
|
||||
textM = "Mental day " + str$(positionM)+ " : " + "peak"
|
||||
Case < - 95
|
||||
textM = "Mental day " + str$(positionM) + " : " + "valley"
|
||||
Case -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5
|
||||
textM = "Mental day " + str$(positionM) + " : " + "critical transition"
|
||||
Case Else
|
||||
textM = "Mental day " + str$(positionM) + " : " + str$(percentageM) + "% (" + TextArray(quadrantM,0) + ")"
|
||||
End Select
|
||||
|
||||
Header1Text = "Born " + Birthdate + ", Target " + Targetdate
|
||||
Header2Text = "Day " + str$(DaysBetween)
|
||||
|
||||
Print Header1Text
|
||||
Print Header2Text
|
||||
Print textP
|
||||
Print textE
|
||||
Print textM
|
||||
Print
|
||||
end fn
|
||||
|
||||
window 1, @"Biorhythms"
|
||||
windowcenter(1)
|
||||
WindowSetBackgroundColor(1,fn ColorBlack)
|
||||
|
||||
print
|
||||
|
||||
// Lets do four different birthdates and target dates
|
||||
text ,,fn colorCyan
|
||||
fn Biorhythm("1943-03-09", "1972-07-11")
|
||||
text ,,fn colorGreen
|
||||
fn Biorhythm("1809-02-12", "1863-11-19") // DOB for Abraham Lincoln
|
||||
text ,,fn colorYellow
|
||||
fn Biorhythm("1809-01-12", "1863-11-19")
|
||||
text ,,fn colorWhite
|
||||
fn Biorhythm("1943-03-09", "1972-07-11") // Bobby Fisher Chess Tournament
|
||||
|
||||
|
||||
handleevents
|
||||
Loading…
Add table
Add a link
Reference in a new issue