Post Reply 
HHC 2018 Programming Contests
10-01-2018, 10:46 AM
Post: #48
RE: HHC 2018 Programming Contests
Here is a slightly updated version of my PPL program, with some simplification, improvement in the results accuracy using ROUND instead of IP, and also using the Function App to do the calculation of the values for the extrema date, as well as to show graphically the different biorhythms centered around the next extrema date:

Code:
EXPORT EXTREMA(BD)
BEGIN
  LOCAL d1,d3;

  // Find Next Extrema date
  N:=DDAYS(BD,Date);
  A:=IP(2*N/23-1/2);
  B:=IP(2*N/28-1/2);
  C:=IP(2*N/33-1/2);
  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))​);
  E:=DATEADD(BD,D);

  // Display results using the Function App: first text, then a graphic view centered on the next extrema
  STARTAPP("Function");
  F1:='100*SIN(4*ACOS(0)*(X MOD 23)/23)';
  F2:='100*SIN(4*ACOS(0)*(X MOD 28)/28)';
  F3:='100*SIN(4*ACOS(0)*(X MOD 33)/33)';
  Xmin:=D-40; Xmax:=D+40; Ymin:=-110; Ymax:=110;  Xtick:=5; Ytick:=10;
  PRINT("Birthday : "+STRING(BD,2,4));
  PRINT("Next Extrema Date: "+STRING(E,2,4));
  d1:=IFTE(POS(L4,D),L1(POS(L4,D)),D);
  d3:=IFTE(POS(L5,D),L3(POS(L5,D)),D);
  PRINT("Physical: "+ROUND(F1(d1),0));
  PRINT("Emotional: "+ROUND(F2(D),0));
  PRINT("Intellectual: "+ROUND(F3(d3),0));
  CHECK({1,2,3});UNCHECK({0,4,5,6,7,8,9});
  STARTVIEW(1);
  RETURN E;
END;


Attached File(s) Thumbnail(s)
               
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 - 3298 - 10-01-2018, 06:37 AM
RE: HHC 2018 Programming Contests - Werner - 10-01-2018, 01:42 PM
RE: HHC 2018 Programming Contests - Didier Lachieze - 10-01-2018 10:46 AM
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)