Post Reply 
HHC 2022 - Programming Contest - no responses until after 6am Monday 6am CENTRAL
09-12-2022, 08:03 PM
Post: #24
RE: HHC 2022 - Programming Contest - no responses until after 6am Monday 6am CENTRAL
(09-12-2022 12:49 PM)3298 Wrote:  This part is a subprogram because it's used in two places: adding the reversed onto the original, and checking for a palindrome (the latter is implemented as an equality check between reversed and original).

Same idea. Better keep the program in one piece, like you did, even though the length increases by some 10% (# 559Ah, 221 bytes).

Code:
 « R→I -105 CF 0 SWAP
  « →STR { "0" } 1 PICK3 SIZE
    START OVER HEAD + SWAP TAIL SWAP
    NEXT NIP "0" OVER TAIL REVLIST +
  » → h
  «
    DO h EVAL ∑LIST OBJ→ SWAP ∑LIST OBJ→ + SWAP 1 + SWAP DUP h EVAL
    UNTIL == PICK3 50 ≥ OR
    END OVER 50 == { DROP2 0 DUP } IFT
  »
»
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2022 - Programming Contest - no responses until after 6am Monday 6am CENTRAL - Gerson W. Barbosa - 09-12-2022 08:03 PM



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