Advertisement
musifter

AoC day 21 part 1 (dc)

Dec 21st, 2021
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #!/usr/bin/dc
  2.  
  3. 1:p 0:p # starting positions
  4.  
  5. 0dsp sr # set player and roll to zero
  6.  
  7. [ lrd100%r1+sr ] SR # put die roll on stack while updating r
  8. [ lRddxrx+rx+3+ ] SS # roll three times and sum
  9.  
  10. [
  11. lSx # roll
  12.  
  13. lp;p+1-10%1+ dlp:p # (p(p) = (p(p) + roll - 1) % 10 + 1) new-p(p) on stack
  14. lp;s + dlp:s # (s(p) = (s(p) + new p(p))) new-s(p) on stack
  15.  
  16. lp1r-sp # toggle player
  17. 1000>L # loop if new-s(p) < 1000
  18. ] SL
  19. lLx
  20.  
  21. [Part 1: ]n lp;s lr*p
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement