dominicletz
Creator of Elixir Desktop
This topic is about Day 8 of the Advent of Code 2020 .
Thanks to @egze, we have a private leaderboard:
https://adventofcode.com/2020/leaderboard/private/view/39276
The join code is:
39276-eeb74f9a
Trending in Challenges
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
dominicletz
Loved part 2 today.
My solution, not clean but working. Everytime a branch fails (returns false) it tries another branch interpreting jmp as nop or vice versa – but only once tracked by the
changedbool - finishes as soon as a valid branch has been found:kwando
My solution for today. I think there might be some trick to the second part, but I went with the brute force approach.. change one instruction and check if the program terminates
code-shoily
Here’s mine. I used brute force for the second one too.
https://github.com/code-shoily/advent_of_code/blob/master/lib/2020/day_8.ex
Damirados
I half brute forced it trying to fix only already ran instructions starting from the last fixable.
Edit: Thinking about it a bit more, and this may be very close to optimal solution. In test example it modifies code only once and in puzzle 10 times before finding correct one.
https://github.com/Damirados/AoC/blob/master/lib/event8.ex
faried
Nothing exciting here!
LostKobrakai
I build a struct + proper API for the bootloader today, before even trying to get to the answers – the goal being someone should be able to understand the code even without knowing the problem. This approach made part two quite simple because all I needed to add was brute-forcing the intended instruction changes and attempting to run the bootloader for each attempt like for part 1.
https://github.com/LostKobrakai/aoc2020/commit/586e5ef8b3bf00697ddbc5f563c936d9e1506600
Damirados
You have all data in place to not brute force it, just run it to first prevent infinite and attempt fixes only on visited instructions.
Rainer
Today was fun
Run until find an error, change the first instruction, run again, change next instruction…
https://github.com/raerkeer/AdventOfCode_2020_Erlang/blob/main/day8.erl
LostKobrakai
This might be an option, but I’d need to change how bootloaders are run, which was nothing I wanted to do. Sure it’s more expensive this way, but the exception (a broken instruction set) should not result in a change for the norm (a fully functioning bootloader runner). It’s questionable how worthwhile those considerations are, but I’m trying to apply them like I might do in the realworld. If being able to run broken instructions would become a responsibility for the bootloader, then it might make sense to go with your approach.
michaelvigor
Here’s part of my solution:
Any opinions on whether the if statement in my
run_programis a code smell? I had wanted to use a guard but I don’t think this is possible.