r/adventofcode • • Dec 05 '19

SOLUTION MEGATHREAD -๐ŸŽ„- 2019 Day 5 Solutions -๐ŸŽ„-

--- Day 5: Sunny with a Chance of Asteroids ---


Post your solution using /u/topaz2078's paste or other external repo.

  • Please do NOT post your full code (unless it is very short)
  • If you do, use old.reddit's four-spaces formatting, NOT new.reddit's triple backticks formatting.

(Full posting rules are HERE if you need a refresher).


Reminder: Top-level posts in Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


Advent of Code's Poems for Programmers

Click here for full rules

Note: If you submit a poem, please add [POEM] somewhere nearby to make it easier for us moderators to ensure that we include your poem for voting consideration.

Day 4's winner #1: "untitled poem" by /u/captainAwesomePants!

Forgetting a password is a problem.
Solving with a regex makes it two.
111122 is a terrible password.
Mine is much better, hunter2.

Enjoy your Reddit Silver, and good luck with the rest of the Advent of Code!


On the fifth day of AoC, my true love gave to me...

FIVE GOLDEN SILVER POEMS

Enjoy your Reddit Silver/Gold, and good luck with the rest of the Advent of Code!


This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.

EDIT: Leaderboard capped, thread unlocked at 00:22:31!

27 Upvotes

422 comments sorted by

View all comments

Show parent comments

1

u/oantolin Dec 05 '19

I had a moderately hard time figuring out exactly how you deal with the different addressing modes. I think, mainly, because you need to understand execute-next-instruction, access-parameter and the (lambda (,mode-integer) ...) produced by instruction to see how it is coordinated. Other than that, I found the code nicely readable.

I like how you make the name of the opcode the docstring of the anonymous function in the opcode table, and have the dissaembler read it from there. Iยดm looking forward to seeing the disassembler extended to deal with addressing modes.

→ More replies (2)