HHC 2018 Programming Contests
09-22-2018, 06:59 PM
Post: #21
 Joe Horn Senior Member Posts: 1,612 Joined: Dec 2013
RE: HHC 2018 Programming Contests
SNEAK PREVIEW...

HHC 2018 attendees: If you think that you might enter the Programming Contest (it will NOT be difficult, so please do toy with the idea), you'll be wise to bring along a pad of paper and some writing implements. Reason: Every contestant will be required to submit a program listing (either hand written or printed), as well as comments (either in the listing or attached to the listing) that explain how the program works, highlighting any features that the contestant deems worthy of note. In other words, you have a real chance to convince me that your program is "elegant". The MOST elegant program wins (in each of the three categories: 41CX RPN, RPL, and PPL).

<0|ɸ|0>
-Joe-
09-29-2018, 07:03 PM
Post: #22
 Joe Horn Senior Member Posts: 1,612 Joined: Dec 2013
RE: HHC 2018 Programming Contests
Rats... things were so hectic here this morning at HHC 2918 that I forgot about posting the contest here! SORRY!

It's in PDF form here: http://hhuc.us/2018/HHC-2018-Programming-Contest.pdf

PLEASE do not post programs here until the contest has been judged at the conference, so that the attendees here are not tempted to submit ideas other than their own. Thanks!

<0|ɸ|0>
-Joe-
09-29-2018, 07:22 PM
Post: #23
 Gene Moderator Posts: 978 Joined: Dec 2013
RE: HHC 2018 Programming Contests
Wow, a post from the future too! :-)
09-29-2018, 07:41 PM
Post: #24
 pier4r Senior Member Posts: 2,019 Joined: Nov 2014
RE: HHC 2018 Programming Contests
(09-29-2018 07:03 PM)Joe Horn Wrote:  Rats... things were so hectic here this morning at HHC 2918 that I forgot about posting the contest here! SORRY!

Can you spoiler a bit? Which calculators did the world produce? I am fine if you can cover the years 2018-2030, although I am not sure that the data survived until 900 years ago (because digital data).

Wikis are great, Contribute :)
09-30-2018, 04:42 AM
Post: #25
 Joe Horn Senior Member Posts: 1,612 Joined: Dec 2013
RE: HHC 2018 Programming Contests
Oops... I forgot to specify that I was referring to HHC 2918 B.C.

<0|ɸ|0>
-Joe-
09-30-2018, 04:58 AM
Post: #26
 grsbanks Senior Member Posts: 1,018 Joined: Jan 2017
RE: HHC 2018 Programming Contests
(09-30-2018 04:42 AM)Joe Horn Wrote:  Oops... I forgot to specify that I was referring to HHC 2918 B.C.

Ah yes, battery life was incredible on those portable stone slabs back in the day. Modern technology is a real step backwards in that respect
09-30-2018, 11:38 AM
Post: #27
 Csaba Tizedes Senior Member Posts: 455 Joined: May 2014
RE: HHC 2018 Programming Contests
(09-29-2018 07:03 PM)Joe Horn Wrote:  Rats... things were so hectic here this morning at HHC 2918 that I forgot about posting the contest here! SORRY!

It's in PDF form here: http://hhuc.us/2018/HHC-2018-Programming-Contest.pdf

PLEASE do not post programs here until the contest has been judged at the conference, so that the attendees here are not tempted to submit ideas other than their own. Thanks!

Is 12C playing?
I have one (not so optimised and not tested) version:

47 steps with closing R/S,
used vars R0, R1, R2, R3.

To run needs

f CLEAR PRGM
input date of today ENTER
birthday R/S
display shows next critical Physical day R/S
shows next critical Emotional day R/S
shows next critical Intellectual day

Csaba
09-30-2018, 05:32 PM
Post: #28
 3298 Member Posts: 111 Joined: Oct 2014
RE: HHC 2018 Programming Contests
(09-30-2018 11:38 AM)Csaba Tizedes Wrote:  display shows next critical Physical day R/S
shows next critical Emotional day R/S
shows next critical Intellectual day
That doesn't sound right ... as far as I understood the challenge, the program shall output a single date on which (at least) two functions are extreme. (If I did my calculations right, there should be a few dates with all three functions at extreme values, but just 8 of these days per 58 or so years. I did not bother calculating the necessary ages for them.) This date shall be accompanied by the values of all three functions on that date.

-----

I have a program for the 50G (should work on most RPL models though) which does what I described above. The presentation post is almost written up. 485 bytes, checksum #7601h. Will post when the judge announces "lunch break is over".
09-30-2018, 07:16 PM
Post: #29
 Csaba Tizedes Senior Member Posts: 455 Joined: May 2014
RE: HHC 2018 Programming Contests
(09-30-2018 05:32 PM)3298 Wrote:  That doesn't sound right ... as far as I understood the challenge, the program shall output a single date on which (at least) two functions are extreme.

"Life is too short to read the manual" -
09-30-2018, 08:32 PM (This post was last modified: 09-30-2018 08:42 PM by Gerson W. Barbosa.)
Post: #30
 Gerson W. Barbosa Senior Member Posts: 1,272 Joined: Dec 2013
RE: HHC 2018 Programming Contests
(09-30-2018 05:32 PM)3298 Wrote:  I have a program for the 50G (should work on most RPL models though) which does what I described above. The presentation post is almost written up. 485 bytes, checksum #7601h. Will post when the judge announces "lunch break is over".

Mine is 356.5 bytes long, CK = #7210h, but it shows only the date.

1.011905 -> 10.102018

9.282018 -> 11.302018

First and probably the only version (started to look at it only this afternoon). Not fully tested yet.

P.S.: Quoting from the rules:

Quote:YOUR CHALLENGE: Write a program (in HP-41 RPN, and/or RPL, and/or PPL) which inputs the user’s birthdate, then outputs the next Extrema Date (not including today) with all three biorhythm values for that date.

I’ve overlooked the last line. Will take care of it soon.
09-30-2018, 08:47 PM
Post: #31
 3298 Member Posts: 111 Joined: Oct 2014
RE: HHC 2018 Programming Contests
Your first example yields the same result on my program. P: -100, E: 62, I: 100.
The second one yields "Invalid Date". Kind of understandable 'cause I've yet to see a calendar with 28 or more months in a year.
Adjusted for my value of system flag 42, the program works and outputs a date that matches after being similarly adjusted. P: -100, E: 100, I: -54.
Actually, that exact date was my first test case too. High-Five!
09-30-2018, 08:49 PM (This post was last modified: 09-30-2018 08:55 PM by Didier Lachieze.)
Post: #32
 Didier Lachieze Senior Member Posts: 1,169 Joined: Dec 2013
RE: HHC 2018 Programming Contests
My PPL version calculates the next Extrema Date in 11 lines (out of EXPORT and BEGIN) and displays the results with another 7 lines before RETURN and the final END;
It returns the same results as Gerson 's program, but the date format is YYYY.MMDD

EXTREMA(1963.0227) returns :

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

And for the dates tested by Gerson :

Birthday : 1905.0101
Next Extrema Date: 2018.1010
Physical: −100
Emotional: 62
Intellectual: 100

Birthday : 2018.0928
Next Extrema Date: 2018.1130
Physical: −100
Emotional: 100
Intellectual: −54
09-30-2018, 09:40 PM (This post was last modified: 09-30-2018 10:06 PM by Gerson W. Barbosa.)
Post: #33
 Gerson W. Barbosa Senior Member Posts: 1,272 Joined: Dec 2013
RE: HHC 2018 Programming Contests
(09-30-2018 08:47 PM)3298 Wrote:  Your first example yields the same result on my program. P: -100, E: 62, I: 100.
The second one yields "Invalid Date". Kind of understandable 'cause I've yet to see a calendar with 28 or more months in a year.
Adjusted for my value of system flag 42, the program works and outputs a date that matches after being similarly adjusted. P: -100, E: 100, I: -54.
Actually, that exact date was my first test case too. High-Five!

I’m using mm/dd/yyyy format (but my program doesn’t depend on the date format, only dates should be entered accordingly).

Now 419 bytes, #EF6Eh.

1.011905 -> 10.102018
{-.99766872413 .623489809462 .998867339316 }

9.282018 -> 11.302018
{-.997668769192 1. -.54064081743}

2.271963 -> 9.292018
{-.99768769852 .623489808919 .99886733949}

No awe from the judge though, I fear :-)

Also, my last example doesn’t agree with Didier’s because I may have misinterpreted the concept of “Extrema date”. I have considered only (-1, 1) or (1, -1), but not (1, 1) and (-1, -1) pairs. I am probably wrong.

P.S.: Quoting again from the rules;

Quote:Once in a while, two cycles hit 100 and/or -100 simultaneously, as you can see on Day 63 above. Let’s call this an “Extrema Date”.

It’s clear from above that the pairs (1, 1) abd (-1, -1) should also be considered. My failure for not thoroughly reading the instructions. By fixing that the program should certainly grow larger than 485 bytes. There’s only one hour left, so I’ll let it as is. Anyway, it was fun to try.
09-30-2018, 09:54 PM (This post was last modified: 09-30-2018 10:09 PM by Didier Lachieze.)
Post: #34
 Didier Lachieze Senior Member Posts: 1,169 Joined: Dec 2013
RE: HHC 2018 Programming Contests
(09-30-2018 09:40 PM)Gerson W. Barbosa Wrote:  2.271963 -> 9.292018
{-.99768769852 .623489808919 .99886733949}

9.292018 is in the past, it doesn't qualify for the next Extrema considering today is September 30th... at least this is my understanding of "next". Also I understand "Once in a while, two cycles hit 100 and/or -100 simultaneously" as allowing any of the (-100, 100), (100, -100), (100, 100) and (-100, -100) pairs.
09-30-2018, 10:22 PM (This post was last modified: 09-30-2018 10:23 PM by Gerson W. Barbosa.)
Post: #35
 Gerson W. Barbosa Senior Member Posts: 1,272 Joined: Dec 2013
RE: HHC 2018 Programming Contests
(09-30-2018 09:54 PM)Didier Lachieze Wrote:
(09-30-2018 09:40 PM)Gerson W. Barbosa Wrote:  2.271963 -> 9.292018
{-.99768769852 .623489808919 .99886733949}

9.292018 is in the past, it doesn't qualify for the next Extrema considering today is September 30th... at least this is my understanding of "next". Also I understand "Once in a while, two cycles hit 100 and/or -100 simultaneously" as allowing any of the (-100, 100), (100, -100), (100, 100) and (-100, -100) pairs.

For some reason my 50g was one day and 7 minutes in the past. Upon setting the date to Sep/30/2018, the new result is

1.232019
{-.979084090955 1. -.998867339471 }

The order is { Ph Em In }

Still wrong per the instructions, but now at least in the future, comme il faut
09-30-2018, 11:24 PM
Post: #36
 Joe Horn Senior Member Posts: 1,612 Joined: Dec 2013
RE: HHC 2018 Programming Contests
The winners were just announced:

Best RPN Programmer: Kerry Veenstra
Best RPL Programmer: Bill Butler
Best PPL Programmer: Eddie Shore

All entries (complete listings and comments) will be posted here as soon as I have time to do so. We're currently having the drawing for the Door Prizes...

<0|ɸ|0>
-Joe-
10-01-2018, 02:55 AM (This post was last modified: 10-01-2018 02:58 AM by Gene.)
Post: #37
 Gene Moderator Posts: 978 Joined: Dec 2013
RE: HHC 2018 Programming Contests
I did not program this, but my thinking went this way... feel free to tell me where I went wrong. :-)

Approach 1:

I treated a triple positive or triple negative as a LCM problem. The 23 day cycle has a +100 or -100 on days 5.75 or17.25. The 28 day cycle on days 7 and 21. The 33 day cycle on days 8.25 and 24.75.

Assumption: The +100 has to be an exact match. A +100 day did not count if it was a 99.8 and a 100.2 and a 100. This could be wrong, but ...

Since you can't (easily?) do a LCM on a decimal number, I found the LCM of 575, 700 and 825. This value is 531,300. Dividing by 100 again, makes a triple event every 5313 days.

So birth plus 5313 should be a triple, plus another 5313 would be a triple, etc. If not, where did I not think properly?

Alternatively...

Approach 2:

I found a website :-) that would do Maximum and minimum bio-dates. This generated a period of 17003 days between extremums. This does not match approach 1, but ... ?

Thoughts?
10-01-2018, 04:57 AM
Post: #38
 Gerson W. Barbosa Senior Member Posts: 1,272 Joined: Dec 2013
RE: HHC 2018 Programming Contests
Now I get Didier’s example right, but the program is now 537 bytes long, CK #EF9Dh, not to mention far from elegant...

27,021963 -> 14.112018
{-,997668769554 -1 -,755749579168 }
10-01-2018, 04:59 AM (This post was last modified: 10-01-2018 05:06 AM by Didier Lachieze.)
Post: #39
 Didier Lachieze Senior Member Posts: 1,169 Joined: Dec 2013
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;
10-01-2018, 05:15 AM
Post: #40
 Gerson W. Barbosa Senior Member Posts: 1,272 Joined: Dec 2013
RE: HHC 2018 Programming Contests
(10-01-2018 02:55 AM)Gene Wrote:  Assumption: The +100 has to be an exact match. A +100 day did not count if it was a 99.8 and a 100.2 and a 100. This could be wrong, but ...

“Once in a while, two cycles hit 100 and/or -100 simultaneously, as you can see on Day 63 above”

On Day 63 the results are actually

-99.7668769192 %

100. % and

-54.064081743 %

But for practical purposes the unexact ones can be rounded to -100% and -54% (FIX 0). Next time I shall read the instructions :-)
 « Next Oldest | Next Newest »

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