bjorng
Erlang Core Team
Advent of Code 2019 - Day 5
Note: This topic is to talk about Day 5 of the Advent of Code 2019.
There is a private leaderboard for elixirforum members. You can join it by following this link and entering the following code:
39276-eeb74f9a
Most Liked
bengtson
Struggled a little with part2 of Day 5. Wrote a disassembler to see what was going on. Hopefully it will be useful for days ahead.
Disassembed Listing: input_05.txt
Program Size: 678
Entry Point: 0
Input List: 5
----------
0: input 5
2: add 5, 1100, 6
6: jmpt 1, 238
238: jmpt 0, 99999
241: jmpt 227, 247
247: jmpt 0, 99999
250: jmpt 3, 256
256: jmpf 227, 99999
259: jmpf 0, 265
265: jmpf 3, 99999
268: jmpf 0, 274
274: jmpt 1, 280
280: add 5, 5, 225
284: add 294, 0, 0
288: jmpt 1, 294
294: jmpf 0, 300
300: add 10, 10, 225
304: add 314, 0, 0
308: jmpf 0, 314
314: cmpeq 226, 677, 224 ; 0 written
318: mul 2, 0, 223
322: jmpf 0, 329
329: cmpless 677, 226, 224 ; 0 written
333: mul 0, 2, 223
337: jmpf 0, 344
344: cmpeq 677, 226, 224 ; 0 written
348: mul 2, 0, 223
352: jmpf 0, 359
359: cmpless 226, 677, 224 ; 1 written
363: mul 2, 0, 223
367: jmpt 1, 374
374: cmpeq 677, 226, 224 ; 0 written
378: mul 0, 2, 223
382: jmpf 0, 389
389: cmpless 677, 677, 224 ; 0 written
393: mul 2, 0, 223
397: jmpf 0, 404
404: cmpless 226, 677, 224 ; 1 written
408: mul 0, 2, 223
412: jmpf 1, 419
415: add 0, 1, 223
419: cmpeq 677, 226, 224 ; 0 written
423: mul 2, 1, 223
427: jmpt 0, 434
430: add 2, 1, 223
434: cmpeq 226, 226, 224 ; 1 written
438: mul 3, 2, 223
442: jmpf 1, 449
445: add 6, 1, 223
449: cmpless 677, 226, 224 ; 0 written
453: mul 7, 2, 223
457: jmpf 0, 464
464: cmpless 226, 677, 224 ; 1 written
468: mul 2, 14, 223
472: jmpt 1, 479
479: cmpless 677, 226, 224 ; 0 written
483: mul 28, 2, 223
487: jmpt 0, 494
490: add 56, 1, 223
494: cmpeq 226, 677, 224 ; 0 written
498: mul 57, 2, 223
502: jmpt 0, 509
505: add 114, 1, 223
509: cmpless 677, 677, 224 ; 0 written
513: mul 115, 2, 223
517: jmpf 0, 524
524: cmpless 677, 677, 224 ; 0 written
528: mul 2, 230, 223
532: jmpt 0, 539
535: add 1, 460, 223
539: cmpless 677, 226, 224 ; 0 written
543: mul 2, 461, 223
547: jmpt 0, 554
550: add 922, 1, 223
554: cmpeq 677, 677, 224 ; 1 written
558: mul 923, 2, 223
562: jmpf 1, 569
565: add 1846, 1, 223
569: cmpeq 226, 677, 224 ; 0 written
573: mul 1847, 2, 223
577: jmpf 0, 584
584: cmpeq 226, 226, 224 ; 1 written
588: mul 3694, 2, 223
592: jmpf 1, 599
595: add 7388, 1, 223
599: cmpeq 677, 226, 224 ; 0 written
603: mul 2, 7389, 223
607: jmpf 0, 614
614: cmpless 226, 226, 224 ; 0 written
618: mul 14778, 2, 223
622: jmpf 0, 629
629: cmpeq 226, 677, 224 ; 0 written
633: mul 2, 29556, 223
637: jmpt 0, 644
640: add 1, 59112, 223
644: cmpless 226, 677, 224 ; 1 written
648: mul 59113, 2, 223
652: jmpt 1, 659
659: cmpeq 226, 226, 224 ; 1 written
663: mul 2, 118226, 223
667: jmpf 1, 674
670: add 236452, 1, 223
674: output 236453
676: stop
----------
Outputs Written: 236453
5
Aetherus
No cheat this time:
I wonder is there a way to call private functions dynamically.
3
xfix
Making heavy use of higher-order functions. I even have functions to modify higher order functions. Worked the first time, somehow.
3
Popular in Challenges
This topic is about Day 7 of the Advent of Code 2020 .
Thanks to @egze, we have a private leaderboard:
https://adventofcode.com/2020/le...
New
Note: This topic is to talk about Day 1 of the Advent of Code 2019.
New
Note: This topic is to talk about Day 16 of the Advent of Code 2019.
There is a private leaderboard for elixirforum members. You can joi...
New
This topic is about Day 15 of the Advent of Code 2020 .
Thanks to @egze, we have a private leaderboard:
https://adventofcode.com/2020/l...
New
Don’t know why the regex ~r/[\W && [^\.]]/x does not work in Elixir. It works pretty well in Ruby.
Anyway, here is my solution:
New
At first I was scared but I found is a simple way to compute the sides.
defmodule AdventOfCode.Solutions.Y24.Day12 do
alias AdventOfCo...
New
This topic is about Day 5 of the Advent of Code 2020 .
Thanks to @egze, we have a private leaderboard:
https://adventofcode.com/2020/le...
New
New
Reasonably pleased with my solution. The bitstring packet problems are so well suited to Erlang/Elixir it’s almost not fair.
defmodule D...
New
Note: This topic is to talk about Day 18 of the Advent of Code 2019.
There is a private leaderboard for elixirforum members. You can joi...
New
Other popular topics
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
New
Hello!
tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability.
After spen...
New
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
Hi there,
I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Hi,
I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New







