Post Reply 
HHC 2016 RPL Programming Contest
09-21-2016, 12:10 AM
Post: #21
RE: HHC 2016 RPL Programming Contest
(09-20-2016 12:23 PM)Gene Wrote:  Winning solution at HHC 2016 came from Roger Hill at 56.5 bytes...

Congratulations to Roger for this winning entry! It appears that both Roger and Juan used a similar approach with slightly different steps, but Roger's was a tad smaller. I made an attempt to translate this same algorithm to a SysRPL implementation, but the smallest I could achieve was still slightly larger than 3298's at 42.5 bytes:

Code:
::
   ZERO
   OVERLEN$
   #1+_ONE_DO (DO)
      OVERINDEX@
      SUB$1# #>CHR
      3PICKSWAP
      ONE POSCHR
      INDEX@
      SWAP#-
      #MAX
   LOOP
   SWAPDROP
   UNCOERCE
;

...and with apologies to 3298, I made an attempt at converting his/her SysRPL code to the closest thing I could manage in UserRPL. There are a couple of variances in how it operates (mostly due to there not being anything like POSCHRREV in UserRPL -- I had to use SREV to even get close), but you can still step through the code to get the gist of the basic algorithm. The code size still came in at a respectable 71.5 bytes, despite the shenanigans required to emulate POSCHRREV. I'm sure this would have been a contender if a UserRPL "POSREV" had existed. It requires a calc with lib 256 attached for the SREV command:
Code:
\<<
  0 1 PICK3 SIZE
  START
    OVER
    DUP
    TAIL 4 ROLLD
    SREV
    ROT
    HEAD
    OVER SIZE UNROT
    POS
    -
    MAX
  NEXT
  NIP
\>>

I've enjoyed seeing everyone's results!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HHC 2016 RPL Programming Contest - Gene - 09-17-2016, 01:39 PM
RE: HHC 2016 RPL Programming Contest - DavidM - 09-21-2016 12:10 AM



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