Post Reply 
HHC 2017 RPN Programming contest information and results thread
09-19-2017, 09:53 AM
Post: #34
RE: HHC 2017 RPN Programming contest information and results thread
Here is my version. It uses synthetic programming. It restores the flags and settings to its previous state and uses register 'a' as counter for the (un-)happy steps.

71 Bytes, no regs.

Regards Bernd

Code:

BYTES   Command
  9     LBL "HAPPY"
  1     LBL 11 
  1     ENTER^
  2     ST- Y       ( prepare Y as summation register)
  1     LBL 12
  2     RCL X
  2     10
  2     ST/ Z
  1     MOD
  1     X^2
  2     ST+ Z       ( calculate sqr sum in Z)
  1     RDN
  1     INT
  1     X#0?
  2     GTO 12
  2     ISG a
  1     ""          ( byte 0xF0 )
  1     RDN
  1     4
  1     X=Y?
  2     GTO 13
  1     SIGN
  1     X<>Y
  1     X#Y?
  2     GTO 11
  1     CLX
  1     LBL 13
  1     CLA
  1     X#0?
  3     "UN"
  8     +"HAPPY "
  2     RCL d
  2     FIX 0
  2     CF 29
  2     ARCL a
  2     STO d
  1     AVIEW
  3     END
--
71 bytes total
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2017 RPN Programming contest information and results thread - Bernd Grubert - 09-19-2017 09:53 AM



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