Post Reply 
HHC 2018 Programming Contests
10-01-2018, 04:59 AM (This post was last modified: 10-01-2018 05:06 AM by Didier Lachieze.)
Post: #39
RE: HHC 2018 Programming Contests
Here is my PPL program. I considered the Extrema Date to be a day during which at least two of the biorhythms would reached +100 or -100.
So first it gets the number of days between the input birthday and today (N).
Then it calculates where we are, as of today, in each cycle (A,B,C)
Then it generates for each biorhythm the list of the next 33 minimum and maximum days. I choosed 33 as it is the maximum number of minimum/maximum occurrences between two common days as I found comparing the lists of maximum/minimums for each biorhythm: there could be 33 physical minimum/maximum between two common physical/Intellectual days.
Then it determines the first common day in two of the three lists (D) and the corresponding date (ED).
The rest of the program is then the display of the results.

Code:
EXPORT EXTREMA(BD)
BEGIN
  LOCAL a:={2*PI,360,400},c,d1,d3,ED;
  c:=a(HAngle+1);
  N:=DDAYS(BD,Date);
  A:=iquo(IP(2*(N-(23/4))),23);
  B:=iquo(IP(2*(N-(28/4))),28);
  C:=iquo(IP(2*(N-(33/4))),33);
  L1:=MAKELIST(23/2*(1/2+I),I,A+1,A+33); L4:=IP(L1);
  L2:=MAKELIST(28/2*(1/2+I),I,B+1,B+33);
  L3:=MAKELIST(33/2*(1/2+I),I,C+1,C+33); L5:=IP(L3);
  D:=MIN(head(INTERSECT(L4,L2)),head(INTERSECT(L2,L5)),head(INTERSECT(L4,L5))​);
  ED:=DATEADD(BD,D);
  PRINT("Birthday : " +BD);
  PRINT("Next Extrema Date: " +STRING(ED,2,4));
  d1:=IFTE(POS(L4,D),L1(POS(L4,D)),D);
  d3:=IFTE(POS(L5,D),L3(POS(L5,D)),D);
  PRINT("Physical: " +IP(100*SIN(c*(d1 MOD 23)/23)));
  PRINT("Emotional: " +IP(100*SIN(c*(D MOD 28)/28)));
  PRINT("Intellectual: " +IP(100*SIN(c*(d3 MOD 33)/33)));
  RETURN ED;
END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HHC 2018 Programming Contests - Joe Horn - 09-13-2018, 02:17 PM
RE: HHC 2018 Programming Contests - pier4r - 09-13-2018, 06:29 PM
RE: HHC 2018 Programming Contests - Zaphod - 09-13-2018, 10:10 PM
RE: HHC 2018 Programming Contests - Gene - 09-13-2018, 10:56 PM
RE: HHC 2018 Programming Contests - Gene - 09-14-2018, 12:06 AM
RE: HHC 2018 Programming Contests - Jlouis - 09-19-2018, 07:00 PM
RE: HHC 2018 Programming Contests - sasa - 09-19-2018, 11:17 AM
RE: HHC 2018 Programming Contests - pier4r - 09-29-2018, 07:41 PM
RE: HHC 2018 Programming Contests - 3298 - 09-30-2018, 05:32 PM
RE: HHC 2018 Programming Contests - 3298 - 09-30-2018, 08:47 PM
RE: HHC 2018 Programming Contests - Gene - 09-29-2018, 07:22 PM
RE: HHC 2018 Programming Contests - Gene - 10-01-2018, 02:55 AM
RE: HHC 2018 Programming Contests - sasa - 10-01-2018, 05:31 AM
RE: HHC 2018 Programming Contests - sasa - 10-01-2018, 09:54 AM
RE: HHC 2018 Programming Contests - Didier Lachieze - 10-01-2018 04:59 AM
RE: HHC 2018 Programming Contests - 3298 - 10-01-2018, 06:37 AM
RE: HHC 2018 Programming Contests - Werner - 10-01-2018, 01:42 PM
RE: HHC 2018 Programming Contests - Werner - 10-02-2018, 06:10 AM
RE: HHC 2018 Programming Contests - Namir - 10-04-2018, 06:09 PM
RE: HHC 2018 Programming Contests - Werner - 10-03-2018, 02:03 PM
RE: HHC 2018 Programming Contests - Werner - 10-04-2018, 05:55 AM
RE: HHC 2018 Programming Contests - 3298 - 10-04-2018, 02:48 PM
RE: HHC 2018 Programming Contests - 3298 - 10-05-2018, 08:26 PM
RE: HHC 2018 Programming Contests - 3298 - 10-06-2018, 12:07 PM
RE: HHC 2018 Programming Contests - 3298 - 10-06-2018, 04:21 PM



User(s) browsing this thread: 1 Guest(s)