Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -21,7 +21,7 @@ F biorhythms(birthdate_str, targetdate_str)
V cycle_lengths = [23, 28, 33]
V quadrants = [(up and rising, peak), (up but falling, transition), (down and falling, valley), (down but rising, transition)]
L(i) 3
L(i) 0.<3
V label = cycle_labels[i]
V length = cycle_lengths[i]
V position = days % length

View file

@ -1,65 +0,0 @@
with Ada.Calendar;
with Ada.Calendar.Arithmetic;
with Ada.Calendar.Formatting;
with Ada.Command_Line;
with Ada.Numerics;
with Ada.Numerics.Elementary_Functions;
with Ada.Text_IO;
use Ada.Calendar;
use Ada.Calendar.Arithmetic;
use Ada.Calendar.Formatting;
use Ada.Command_Line;
use Ada.Numerics;
use Ada.Numerics.Elementary_Functions;
use Ada.Text_IO;
procedure Biorhythms is
Birth_Date : Time := Value (Argument (1) & " 00:00:00");
Target_Date : Time := Value (Argument (2) & " 00:00:00");
Days : Day_Count := Target_Date - Birth_Date;
-- There's not much point having types for these for such a short
-- problem, but in a big program this would be useful to prevent
-- accidentally assigning wrong values.
type Physical_Type is mod 23;
type Emotional_Type is mod 28;
type Mental_Type is mod 33;
type Biorhythm_Type is
record
Physical : Physical_Type;
Emotional : Emotional_Type;
Mental : Mental_Type;
end record;
function To_Biorhythm (D : Day_Count) return Biorhythm_Type is
(
Physical_Type (D mod Physical_Type'Modulus),
Emotional_Type (D mod Emotional_Type'Modulus),
Mental_Type (D mod Mental_Type'Modulus)
);
Biorhythm : Biorhythm_Type := To_Biorhythm (Days);
package Float_IO is new Ada.Text_IO.Float_IO (Float);
use Float_IO;
function To_Percent (F : Float) return Float is
(100.0 * Sin (2.0 * Pi * F));
procedure Report_Biorhythm (B : Biorhythm_Type) is
PFrac : Float := Float (B.Physical) / Float (Physical_Type'Modulus);
EFrac : Float := Float (B.Emotional) / Float (Emotional_Type'Modulus);
MFrac : Float := Float (B.Mental) / Float (Mental_Type'Modulus);
Physical : Float := To_Percent (PFrac);
Emotional : Float := To_Percent (EFrac);
Mental : Float := To_Percent (MFrac);
begin
Put_Line ("Age in days: " & Days'Image);
Put ("Physical cycle: "); Put (Physical, 3, 1, 0); Put ("%"); New_Line;
Put ("Emotional cycle: "); Put (Emotional, 3, 1, 0); Put ("%"); New_Line;
Put ("Mental cycle: "); Put (Mental, 3, 1, 0); Put ("%"); New_Line;
end Report_Biorhythm;
begin
Report_Biorhythm (Biorhythm);
end Biorhythms;

View file

@ -1,144 +0,0 @@
identification division.
program-id. bio.
environment division.
*************************************************************
**** To execute on command line enter program name followed
**** by birth date ccyymmdd and then target date.
**** Example: bio 18090102 18631117
**** Will display the three cycles:
**** Physcial 23 days, Emotional 28 days, Mental 33 days
**** for that date.
****
*************************************************************
configuration section.
source-computer.
System76
* with debugging mode
.
repository.
function all intrinsic.
data division.
working-storage section.
01 w-d1 pic x(08).
01 w-d2 pic x(08).
01 n-d1 pic 9(08).
01 n-d2 pic 9(08).
01 w-i1 comp-x pic x(04).
01 w-i2 comp-x pic x(04).
01 w-days pic 9(07).
01 arg-knt comp-5 pic x(01).
01 bx pic 9.
01 bio-tbl value 'Physical 23Emotional28Mental 33'.
05 bio-entry occurs 3 times.
10 bio-cyc pic x(09).
10 bio-lth pic 9(02).
01 bio-data occurs 3 times.
05 bio-mod pic 9(02).
05 bio-sin pic s999v9.
05 bio-dsc pic x(09).
procedure division.
accept arg-knt from argument-number
if arg-knt <> 2
then
display 'two arguments are required:' upon SYSERR
display ' 1. first date ccyymmdd' upon SYSERR
display ' 2. second date ccyymmdd' upon SYSERR
stop run returning -1
end-if
accept w-d1 from argument-value
if w-d1 not numeric
display ' first date not numeric ' upon syserr
move 2 to return-code
stop run
end-if
move w-d1 to n-d1
if (n-d1 > 99991231)
display ' first date must be less than 99991232'
upon syserr
move 3 to return-code
stop run
end-if
if (n-d1 < 16010101)
display ' first date must be greater than 16010100'
upon syserr
move 4 to return-code
stop run
end-if
if ((n-d1(5:2) = '00')
or
(n-d1(5:2) > '12'))
display ' invalid month for first date ' upon syserr
move 5 to return-code
stop run
end-if
if ((n-d1(7:2) = '00')
or
(n-d1(7:2) > '31'))
display ' invalid day for first date ' upon syserr
move 6 to return-code
stop run
end-if
accept w-d2 from argument-value
if w-d2 not numeric
display 'second date not numeric ' upon syserr
move 12 to return-code
stop run
end-if
move w-d2 to n-d2
if (n-d2 > 99991231)
display ' second date must be less than 99991232'
upon syserr
move 13 to return-code
stop run
end-if
if (n-d2 < 16010101)
display ' second date must be greater than 16010100'
upon syserr
move 14 to return-code
stop run
end-if
if ((n-d2(5:2) = '00')
or
(n-d2(5:2) > '12'))
display ' invalid month for second date ' upon syserr
move 15 to return-code
stop run
end-if
if ((n-d2(7:2) = '00')
or
(n-d2(7:2) > '31'))
display ' invalid day for second date ' upon syserr
move 16 to return-code
stop run
end-if
move w-d1 to n-d1
move w-d2 to n-d2
move integer-of-date(n-d1) to w-i1
move integer-of-date(n-d2) to w-i2
compute w-days = w-i1 - w-i2
display w-days
perform varying bx from 1 by 1 until bx greater than 3
move mod(w-days, bio-lth(bx)) to bio-mod(bx)
compute bio-sin(bx) rounded
= 100 * sin(2 * PI * bio-mod(bx) / bio-lth(bx))
end-compute
display bio-cyc(bx) " "
bio-mod(bx) ":"
bio-sin(bx) "%" with no advancing
end-display
if bio-sin(bx) > 95
move " peak" to bio-dsc(bx)
end-if
if bio-sin(bx) < -95
move " valley" to bio-dsc(bx)
end-if
if abs(bio-sin(bx)) < 5
move " critical" to bio-dsc(bx)
end-if
display bio-dsc(bx)
end-perform
move 0 to return-code
goback
.

View file

@ -1,9 +0,0 @@
Compile and Test
C:\GnuCOBOL>
C:\GnuCOBOL>cobc -x bio.cbl
C:\GnuCOBOL>bio 18090112 18631119
0020034
Physical 01:+027.0%
Emotional 14:+000.0% critical
Mental 03:+054.1%

View file

@ -1,15 +0,0 @@
(require 'calendar)
(setq biorhythm-birthdate '(3 16 1953))
(defun biorhythm ()
"Show today's biorhythm."
(interactive)
(let* ((diff (abs (- (string-to-number (calendar-astro-date-string
biorhythm-birthdate)) (string-to-number
(calendar-astro-date-string)))))
(rhyt '(23 28 33))
(perc (mapcar (lambda (x) (round (* 100 (sin
(* 2 pi diff (/ 1.0 x)))))) rhyt)))
(message "age: %i physical: %i%% emotional: %i%% intellectual: %i%%"
diff (car perc) (cadr perc) (caddr perc))))

View file

@ -11,9 +11,9 @@ const quadrants = [
]
// Parameters assumed to be in YYYY-MM-DD format.
fn biorhythms(birth_date string, target_date string) ? {
bd := time.parse_iso8601(birth_date)?
td := time.parse_iso8601(target_date)?
fn biorhythms(birth_date string, target_date string) ! {
bd := time.parse_iso8601(birth_date)!
td := time.parse_iso8601(target_date)!
days := int((td-bd).hours() / 24)
println("Born $birth_date, Target $target_date")
println("Day $days")
@ -51,6 +51,6 @@ fn main() {
["1809-02-12", "1863-11-19"], // correct DOB for Abraham Lincoln
]
for date_pair in date_pairs {
biorhythms(date_pair[0], date_pair[1])?
biorhythms(date_pair[0], date_pair[1])!
}
}