Advertisement
musifter

AoC 2022, day 10 (dc part 1)

Dec 10th, 2022
242
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | Source Code | 0 0
  1. # stack: time regX sum
  2. [
  3. d 3R d 3R * # (regX * time) time regX sum
  4. 4R+ r3R # s = (s + (regX * time)), stack: time regX sum
  5. ] sS
  6.  
  7. # main loop (stack: time regX sum ...)
  8. [
  9. 1+ # time++ regX sum ...
  10. d 40% # time%40 time regX sum ...
  11. 20=S # score if time%40 = 20, stack: time regX sum ...
  12.  
  13. r4R # pull up data: data regX time sum ...
  14. + # (regX += data) time sum ...
  15. r # time regX sum ...
  16. z 3<L # loop until only 3 left
  17. ] sL
  18.  
  19. 0 1 d lLx
  20.  
  21. [Part 1: ]n 3Rp
  22.  
  23. [<END>]ps.
  24. [<stack>]ps. f [<bottom>]ps.
  25.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement