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 the Advent of Code 2021 - Day 4.
Thanks to @bjorng , we now have a new Private Leaderboard.
The entry code is:
370...
New
Here is my solution for day 4:
New
This topic is about Day 16 of the Advent of Code 2021.
We have a private leaderboard (shared with users of Erlang Forums):
https://adve...
New
Continuation of Advent of Code 2022:christmas_tree:, Day 1:
Day 2!
Leaderboard:
New
Ok, that was a rough one today.
I haven’t found a way to improve the algorithm further. Part 1 runs in .5 seconds, Part 2 in ~ 5 minutes...
New
Monkeys fitted squarely as GenServers in my head. My initial problem was using cast instead of call; I imagine impolite monkeys slinging...
New
It is that time of the year again: Advent of Code 2022 :christmas_tree:
Day 1
Leaderboard:
New
New
I’m having so much fun working on the “Protohackers” challenges, I never got into Advent of Code much but this has been amazing. The chal...
New
I spent 3 hours struggling in part 2, until I noticed a very basic mistake :joy:
Here’s my code:
By the way, the starting position in...
New
Other popular topics
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
can someone please explain to me how Enum.reduce works with maps
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
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
I have a User schema with a :from_id field set to type :string:
defmodule TweetBot.Repo.Migrations.CreateUsers do
use Ecto.Migration
...
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
I have a super simple question about elixir - how would I take a file like this
foo bar baz
and output a new file that enumerates th...
New







