Post Reply 
HHC 2018 Programming Contests
10-05-2018, 07:45 AM
Post: #71
RE: HHC 2018 Programming Contests
OK, so this makes my PPL program a little bit simpler:
Code:
EXPORT EXTREMA(BD)
BEGIN

  // 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(ROUND(23/2*(1/2+I),0),I,A+1,A+33);
  L2:=MAKELIST(28/2*(1/2+I),I,B+1,B+33);
  L3:=MAKELIST(ROUND(33/2*(1/2+I),0),I,C+1,C+33);
  D:=MIN(head(INTERSECT(L1,L2)),head(INTERSECT(L2,L3)),head(INTERSECT(L1,L3))​);
  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));
  PRINT("Physical: "+ROUND(F1(D),0));
  PRINT("Emotional: "+ROUND(F2(D),0));
  PRINT("Intellectual: "+ROUND(F3(D),0));
  CHECK({1,2,3});UNCHECK({0,4,5,6,7,8,9});
  STARTVIEW(1);
  RETURN E;
END;

Do you have a list of test dates and results to check?
Here are some results from the program above:
Code:
Birthday : 1955.0819
Next Extrema Date: 2018.1022
Physical: 100
Emotional: 62
Intellectual: 100

Birthday : 2018.0928
Next Extrema Date: 2018.1130
Physical: −100
Emotional: 100
Intellectual: −54

Birthday : 1963.0227
Next Extrema Date: 2018.1114
Physical: −100
Emotional: −100
Intellectual: −76

Birthday : 1905.0101
Next Extrema Date: 2018.1010
Physical: −100
Emotional: 62
Intellectual: 100
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 - 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 - Didier Lachieze - 10-05-2018 07:45 AM
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: 22 Guest(s)