2019, take 2 #2

Open
aey wants to merge 19 commits from 2019-rerun into main
Owner
No description provided.
aey added 19 commits 2025-02-11 12:21:08 +00:00
Refactored the intcode computer to live in a separate
file, since it will come back more times.

As a nice touch, output of aoc.py will print the version
used of the intcode.

As another nice touch, the int code has a CHANGELOG.
Tried to solve part 2 using BFS, but did not
figure out a way to find shortest path. Fell
back to a less elegant but more simple
approach.
Breaking change for intcode 0.3.0, revisited
earlier use of the computer to update code.
This was a hard one. I would not have made it
without r/adventofcode where all assertions
in __main__ were fetched. For values it was
straight forward enough, but for some reason
it did not work for positioning.

I still do not understand how one is supposed to
chew the WALL OF TEXT each day of 2019 and figure
out these stuffs on your own.

It took 10-12 hours to solve part 1. AoC day 9
is no joke.

Links that helped me:

- https://www.reddit.com/r/adventofcode/comments/e8aw9j/2019_day_9_part_1_how_to_fix_203_error/
- https://www.reddit.com/r/adventofcode/comments/jr9xrn/comment/gbwr85k/
Bugs discovered in intcode:

- Relative base was reset on await input suspend.
- No handling for incorrect intcodes.
- State was sometimes corrupted when resumed after
  suspend.

Fixed and Patched in 0.3.2
Also, fix bug in ints() helper.
Got stuck completely at part 1. Last 2 examples
did not add up, off by 100 ore.

I did know that I had to count by overflows somehow,
but I could not manage it. After countless hours
writing a verbose debugger, I wiped the whole thing
and looked at this code for inspiration:

https://github.com/sophiebits/adventofcode/blob/master/2019/day14.py

It works by using modulus and removing all keys
in a dict except ORE.
Solution takes several hours to run, commented out and cached.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 2019-rerun:2019-rerun
git checkout 2019-rerun

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout main
git merge --no-ff 2019-rerun
git checkout 2019-rerun
git rebase main
git checkout main
git merge --ff-only 2019-rerun
git checkout 2019-rerun
git rebase main
git checkout main
git merge --no-ff 2019-rerun
git checkout main
git merge --squash 2019-rerun
git checkout main
git merge --ff-only 2019-rerun
git checkout main
git merge 2019-rerun
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: aey/advent-of-code#2
No description provided.