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: :: ...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: \<< I've enjoyed seeing everyone's results! |
|||
09-21-2016, 11:42 AM
Post: #22
|
|||
|
|||
RE: HHC 2016 RPL Programming Contest
(09-21-2016 12:10 AM)DavidM Wrote: 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:Nosy gave me a handy routine you could use to get your size down to mine. At 13FD8 there is this small secondary; Code: :: ONE POSCHR ; (09-21-2016 12:10 AM)DavidM Wrote: ...and with apologies to 3298What for? I posted code on a public forum without any copyright notice, so it's meant to be read, understood, used, and modified. This wasn't quite the kind of modification I expected (that would have been some more size optimization), but it's perfectly fine. Such a little snippet isn't worth putting a copyright on anyway. You even beat my own UserRPL translation by several commands. About NIP: I think that's a Forth thing. As that's another important language in reverse polish notation, it's kind of expected RPL borrows some Forth concepts. Another example: The Forth equivalent of a FOR...NEXT is DO...LOOP, and in SysRPL they are - surprise! - written as DO...LOOP. Or even more basic, a Forth program is delimited by colon and semicolon. SysRPL just doubles the colon, possibly because on RPL.machines you usually get colons in pairs (for tagged objects). |
|||
09-21-2016, 02:14 PM
Post: #23
|
|||
|
|||
RE: HHC 2016 RPL Programming Contest
(09-21-2016 11:42 AM)3298 Wrote: Nosy gave me a handy routine you could use to get your size down to mine. At 13FD8 there is this small secondary; When I was scanning through the code to optimize it, I focused on that very sequence thinking that it was a very obvious choice for a "combo" command. I was surprised it wasn't already a published. Thanks for the reminder that Nosy can search for references to a command -- I had forgotten that feature. |
|||
09-22-2016, 12:43 AM
Post: #24
|
|||
|
|||
RE: HHC 2016 RPL Programming Contest
Like everybody else, I sure have fun programming and I learned something, thanks DavidM.
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)