RJPlog

44948239?v=4

RJPlog
: RJPlog

About me

Nothing here yet. Update your profile at /profiles/RJPlog.adoc

Day 00: m5stack

I’ll use the M5Stack to solve the puzzle on my arduino. I guess all info you may be interested in m5stack can be found on the homepage, at least it is more than I know by myself about it ;-)

The M5Stack I bought about one and a half year ago was a suggestion from a colleague of mine and I liked the concept, even if there are cheaper boards.

The idea was to teach my children something about software, and therefore this M5Stack looked like a good idea, since it was running without having to do some haredware soldering etc..

But so far it turned out as an useless exercise, since my little programms cannot compete against fortnite :-(.

So at least I have some fun, started learning something about git, github and some other stuff (I started my first programming experience with a C64 in the early 1980ies, software is something I am interested since this time, but I am not coding in my job) and hopefully it will help me through the AoC ;-)

Here is my first Hello World:

// day00 by RJPlog, 29.11.2019

#include <M5Stack.h>

void setup() {
  // put your setup code here, to run once:

  M5.begin();
  M5.Lcd.fillScreen(BLACK);
  M5.Lcd.setCursor(0, 80);
  M5.Lcd.setTextColor(M5.Lcd.color565(255, 131, 250));
  M5.Lcd.setTextSize(3);
  M5.Lcd.println(" hello world ");
}

void loop() {
  // put your main code here, to run repeatedly:

}

Day 01: m5stack

this documentation is autogenerated. Add a README.adoc to your solution to take over the control of this :-)

m5stack

day01_m5stack.ino
// day01 by RJPlog, 01.12.2019

#include <M5Stack.h>

int i = 100; // amount of modules
int x; // counter
int fuel_counter_upper = 0;
int temporary_fuel = 0; //needed only for 2nd part
int mass[] = {54172,
              58469,
              92948,
              143402,
              57563,
              54532,
              68042,
              89847,
              70872,
              54069,
              107310,
              146439,
              88851,
              142869,
              71309,
              89613,
              70338,
              87708,
              95305,
              134384,
              128250,
              134991,
              91270,
              127819,
              68650,
              102556,
              129882,
              68688,
              129939,
              137344,
              102624,
              90828,
              86487,
              91712,
              114866,
              75697,
              107599,
              99053,
              87511,
              128128,
              57772,
              69314,
              90771,
              145376,
              100730,
              142675,
              112731,
              83985,
              123565,
              127325,
              86597,
              121772,
              131992,
              148859,
              93348,
              77294,
              119763,
              74636,
              95592,
              79628,
              78861,
              68565,
              88820,
              134291,
              69262,
              128678,
              118216,
              52799,
              92731,
              61600,
              63477,
              64016,
              131872,
              131412,
              146579,
              104400,
              99110,
              63458,
              144393,
              54787,
              148622,
              91323,
              61137,
              106082,
              103644,
              63795,
              126648,
              61489,
              140964,
              110963,
              72696,
              124370,
              110466,
              139317,
              108440,
              148062,
              89992,
              145645,
              70556,
              95739
             }; // mass of each module


void setup() {
  // put your setup code here, to run once:

  M5.begin();
  M5.Lcd.fillScreen(BLACK);
  M5.Lcd.setCursor(0, 0);
  M5.Lcd.setTextColor(M5.Lcd.color565(255, 131, 250));
  M5.Lcd.setTextSize(2);
  M5.Lcd.println("Hi Santa, before going to lauch we need your help:");
  M5.Lcd.println("We need the amount of modules and the mass for each modul.");


  // --- Day 1: The Tyranny of the Rocket Equation ---

  // fuel for each modul
  for (int x = 0; x < i; x++) {
    fuel_counter_upper = fuel_counter_upper + mass[x] / 3 - 2;
  }
 M5.Lcd.setTextColor(M5.Lcd.color565(255, 100, 100));
  M5.Lcd.println("The needed amount of fuel for the modules is:");
  M5.Lcd.println(fuel_counter_upper);

  // fuel for each modul including fuel for fuel
  fuel_counter_upper = 0;
  for (int x = 0; x < i; x++) {
    temporary_fuel = mass[x] / 3 - 2;
    while (temporary_fuel > 0) {
      fuel_counter_upper = fuel_counter_upper + temporary_fuel;
      temporary_fuel = temporary_fuel / 3 - 2;
    }

  }
  M5.Lcd.println("The needed amount of fuel for the modules including fuel for fuel is:");
  M5.Lcd.println(fuel_counter_upper);
}


void loop() {
  // put your main code here, to run repeatedly:


}

Day 02: m5stack

this documentation is autogenerated. Add a README.adoc to your solution to take over the control of this :-)

m5stack

day02_m5stack.ino
// day02 by RJPlog, 02.12.2019

#include <M5Stack.h>

int i = 10000; // max lines of programm
int x; // counter

int gravity_assist_prog[] = {1,12,2,3,1,1,2,3,1,3,4,3,1,5,0,3,2,1,6,19,2,19,6,23,1,23,5,27,1,9,27,31,1,31,10,35,2,35,9,39,1,5,39,43,2,43,9,47,1,5,47,51,2,51,13,55,1,55,10,59,1,59,10,63,2,9,63,67,1,67,5,71,2,13,71,75,1,75,10,79,1,79,6,83,2,13,83,87,1,87,6,91,1,6,91,95,1,10,95,99,2,99,6,103,1,103,5,107,2,6,107,111,1,10,111,115,1,115,5,119,2,6,119,123,1,123,5,127,2,127,6,131,1,131,5,135,1,2,135,139,1,139,13,0,99,2,0,14,0};

void setup() {
  // put your setup code here, to run once:

  M5.begin();
  M5.Lcd.fillScreen(BLACK);
  M5.Lcd.setCursor(0, 0);
  M5.Lcd.setTextColor(M5.Lcd.color565(255, 131, 250));
  M5.Lcd.setTextSize(2);
  M5.Lcd.println("Hi Santa, before continuing we need your help:");
  M5.Lcd.println("We need the first number of the gravity assist programm.");


  // --- Day 2: 1202 Program Alarm ---

  for (int x = 0; x < i; x = x + 4) {
    if (gravity_assist_prog[x] == 1) {
      gravity_assist_prog[gravity_assist_prog[x + 3]] = gravity_assist_prog[gravity_assist_prog[x + 1]] + gravity_assist_prog[gravity_assist_prog[x + 2]];
    }
    else if (gravity_assist_prog[x] == 2) {
      gravity_assist_prog[gravity_assist_prog[x + 3]] = gravity_assist_prog[gravity_assist_prog[x + 1]] * gravity_assist_prog[gravity_assist_prog[x + 2]];
    }
    else if (gravity_assist_prog[x] == 99) {
      break;
    }
  }
  M5.Lcd.setTextColor(M5.Lcd.color565(255, 100, 100));
  M5.Lcd.println("The first number of the program is:");
  M5.Lcd.println(gravity_assist_prog[0]);
}

void loop() {
  // put your main code here, to run repeatedly:

}

Day 03: VBA

1203 Crossed Wires

The original puzzle can be found at https://adventofcode.com/2019/day/3

Today again I started in the morning in best mood to finish the puzzle before children were ready for school. Unfortunately I had to recognise, that with my M5Stack board and Arduino my skills are not enough to solve the puzzle, starting the separation of the input data into direction and length.

So I decided to work with the only environment I had at hand, Excel and VBA, which I never used before. Therefore the day startet with internet turials. Nearly very instruction I had to look up in the internet. But I did not want to give up. Finaly I made it, even if there are some pre- and postprocessing steps.

First Star

First of all I read the input vector into a Excelsheet and transformed it in a way that direction and number of steps are seperated. From there the program itself reads out and starts with the first path to mark in the Excelsheet with "1", to make clear that somebody was already here, then the second path and where already a "1" was, I marked an "X". At the same time I calculated the distance to the starting point.

Here it took me some time to puzzle out what the best starting point is according to placing the path in the excelsheet, since the input data could also go more to the left than the startingpoint.

A second major issue I found by my first aproach, that the first path could cross it’s own way, and I marked them also with "X", which lead to the wrong output, so I had to distinguish between a crossing of the path itself or both.

I wrote all crossing points in the excel and did afterwards a min selection, I was to tired to programm it, even if it would have been easy.

Second Star

For the second star I made the assumtion, that the shortes way would be from the starting point, either following the first path or the second, but not a crossing in between. So I drew the first path, then the second and counted until the first crossing. Then I followed again the firstpath until reaching the crossing and counted again. Afterwars I changed order of both pathes and did the procedure again, but this I made by hand. The minimum of both values was the right input.

Day 04: VBA

Day 4: Secure Container

The original puzzle can be found at https://adventofcode.com/2019/day/4

Today I did it just with calculation of all variants by interlaced for loops and then checking if the number fits the rules, nothing special about that.

For the last part with my puzzle input I had to check manually in the excelsheet.

I struggled to put the 6 numbers together to a number which I could check if inbound or outbound. Even with using long it does not work.

Maybe that’s something I will figure out later, in the moment I am glad to be through for day04.

Day 05: VBA

this documentation is autogenerated. Add a README.adoc to your solution to take over the control of this :-)

VBA

AoC_2019_day05_part1.adoc
== Day 5: Sunny with a Chance of Asteroids

The original puzzle can be found at https://adventofcode.com/2019/day/5

First and second part solved. Especially the second part made some difficulties with those nested if's for position mode and immediate mode.
I had to test every single case, which I started unstructured, therefore I did it over and over :-)

Details to be found in VBA :-). If I have time in the evening, I will add some comments in the readme.
AoC_2019_day05_part1.xlsm
Unresolved directive in ../../../../../../day05/VBA/RJPlog/AoC_2019_day05_part1.xlsm - include::AoC_2019_day05_part1.xlsm[]

.AoC_2019_day05_part2.xlsm
[source]

include::AoC_2019_day05_part2.xlsm[]

:leveloffset!:


++++
<a id="day06" />
++++

=== Day 06: VBA

:leveloffset: +2


[small]#this documentation is autogenerated. Add a `README.adoc` to your solution to take over the control of this :-)#

== VBA


.AoC_2019_day06.adoc
[source]

Star 1

This day for part 1 I had to start with recursive algorithms to evaluate the direct and indirect orbits. Since my puzzle input included 2603 relations and the middle length of the orbits was 239, it took more than 3 hours to calculate in Excel VBA, so this is a real disadvantage. But the VBA programming hat also a big advantage, it was easy to develop the algorithm, so that I had the 3 hours only once ;-), with this times of calculation you have to be carefull.

Star 2

Calculating recursive the path to COM from YOU and SAN, afterwards starting from YOU to find the next fit in the row with SAN (wich is the nearest crossing point)

.AoC_2019_day06_part1.xlsm
[source]

Unresolved directive in ../../../../../../day06/VBA/RJPlog/AoC_2019_day06_part1.xlsm - include::AoC_2019_day06_part1.xlsm[]

AoC_2019_day06_part2.xlsm
include::AoC_2019_day06_part2.xlsm[]
Day 07: VBA

this documentation is autogenerated. Add a README.adoc to your solution to take over the control of this :-)

VBA
AoC_2019_day07_part1.xlsm
Unresolved directive in ../../../../../../day07/VBA/RJPlog/AoC_2019_day07_part1.xlsm - include::AoC_2019_day07_part1.xlsm[]

.AoC_2019_day07.adoc
[source]

include::AoC_2019_day07.adoc[]

.AoC_2019_day07_part2.xlsm
[source]

include::AoC_2019_day07_part2.xlsm[]

:leveloffset: 2


++++
<a id="day08" />
++++

=== Day 08: VBA

:leveloffset: +2


[small]#this documentation is autogenerated. Add a `README.adoc` to your solution to take over the control of this :-)#

== VBA


.AoC_2019_day08_part1.xlsm
[source]

Unresolved directive in ../../../../../../day08/VBA/RJPlog/AoC_2019_day08_part1.xlsm - include::AoC_2019_day08_part1.xlsm[]

AoC_2019_day08_part2.xlsm
include::AoC_2019_day08_part2.xlsm[]
AoC_2019_day08.adoc
include::AoC_2019_day08.adoc[]
Day 09: VBA

this documentation is autogenerated. Add a README.adoc to your solution to take over the control of this :-)

VBA
AoC_2019_day09_part2.xlsm
Unresolved directive in ../../../../../../day09/VBA/RJPlog/AoC_2019_day09_part2.xlsm - include::AoC_2019_day09_part2.xlsm[]

.AoC_2019_day09_part1.xlsm
[source]

include::AoC_2019_day09_part1.xlsm[]

.AoC_2019_day09.adoc
[source]

include::AoC_2019_day09.adoc[]

:leveloffset: 4


++++
<a id="day10" />
++++

=== Day 10: VBA

:leveloffset: +2


[small]#this documentation is autogenerated. Add a `README.adoc` to your solution to take over the control of this :-)#

== VBA


.AoC_2019_day10_part2.xlsm
[source]

Unresolved directive in ../../../../../../day10/VBA/RJPlog/AoC_2019_day10_part2.xlsm - include::AoC_2019_day10_part2.xlsm[]

AoC_2019_day10_part1.xlsm
include::AoC_2019_day10_part1.xlsm[]
AoC_2019_day10.adoc
include::AoC_2019_day10.adoc[]
Day 11: VBA

this documentation is autogenerated. Add a README.adoc to your solution to take over the control of this :-)

VBA
AoC_2019_day11_part1.xlsm
Unresolved directive in ../../../../../../day11/VBA/RJPlog/AoC_2019_day11_part1.xlsm - include::AoC_2019_day11_part1.xlsm[]

.AoC_2019_day11.adoc
[source]

include::AoC_2019_day11.adoc[]

:leveloffset: 6


++++
<a id="day12" />
++++

=== Day 12: VBA

:leveloffset: +2


[small]#this documentation is autogenerated. Add a `README.adoc` to your solution to take over the control of this :-)#

== VBA


.AoC_2019_day12.adoc
[source]
Day 12:

The original puzzle can be found at https://adventofcode.com/2019/day/12

Star 1

tbfol (to be filled out later)

Star 2

tbfol

.AoC_2019_day12_part2.xlsm
[source]

Unresolved directive in ../../../../../../day12/VBA/RJPlog/AoC_2019_day12_part2.xlsm - include::AoC_2019_day12_part2.xlsm[]

AoC_2019_day12_part1.xlsm
include::AoC_2019_day12_part1.xlsm[]
Day 13: VBA

this documentation is autogenerated. Add a README.adoc to your solution to take over the control of this :-)

VBA
AoC_2019_day13_part2.xlsm
Unresolved directive in ../../../../../../day13/VBA/RJPlog/AoC_2019_day13_part2.xlsm - include::AoC_2019_day13_part2.xlsm[]

.AoC_2019_day13_part1.xlsm
[source]

include::AoC_2019_day13_part1.xlsm[]

.AoC_2019_day13.adoc
[source]

include::AoC_2019_day13.adoc[]

:leveloffset: 8


++++
<a id="day14" />
++++

=== Day 14: VBA

:leveloffset: +2


[small]#this documentation is autogenerated. Add a `README.adoc` to your solution to take over the control of this :-)#

== VBA


.AoC_2019_day14_part1.xlsm
[source]

Unresolved directive in ../../../../../../day14/VBA/RJPlog/AoC_2019_day14_part1.xlsm - include::AoC_2019_day14_part1.xlsm[]

AoC_2019_day14.adoc
include::AoC_2019_day14.adoc[]
AoC_2019_day14_part2.xlsm
include::AoC_2019_day14_part2.xlsm[]
Day 15: VBA

this documentation is autogenerated. Add a README.adoc to your solution to take over the control of this :-)

VBA
AoC_2019_day15_part1.xlsm
Unresolved directive in ../../../../../../day15/VBA/RJPlog/AoC_2019_day15_part1.xlsm - include::AoC_2019_day15_part1.xlsm[]

.AoC_2019_day15_part2.xlsm
[source]

include::AoC_2019_day15_part2.xlsm[]

.AoC_2019_day15.adoc
[source]

include::AoC_2019_day15.adoc[]

:leveloffset: 10


++++
<a id="day16" />
++++

=== Day 16: kotlin

:leveloffset: +2

== Flawed Frequency Transmission

=== Part 1

look at VBA

=== Part 2

Trying to solve part to in VBA with just enhancing the input vector I recognised very fast that this will not come to an end in an appropriate time.
Not finding a really good solution to make the algorithm easier, I decided to use some other language. This is the first try, I just adapted the VBA code to Kotlin.
I choosed Kotlin since Corneil was the one with the most solutions, and he did it in kotlin :-)
It took still 14 hours, but the goal was to start learning something new, here is the first result.


:leveloffset: 12


++++
<a id="day16" />
++++

=== Day 16: VBA

:leveloffset: +2


[small]#this documentation is autogenerated. Add a `README.adoc` to your solution to take over the control of this :-)#

== VBA


.AoC_2019_day16_part1.xlsm
[source]

Unresolved directive in ../../../../../../day16/VBA/RJPlog/AoC_2019_day16_part1.xlsm - include::AoC_2019_day16_part1.xlsm[]

AoC_2019_day16.adoc
include::AoC_2019_day16.adoc[]
AoC_2019_day16_part2.xlsm
include::AoC_2019_day16_part2.xlsm[]
Day 17: VBA

this documentation is autogenerated. Add a README.adoc to your solution to take over the control of this :-)

VBA
AoC_2019_day17.adoc
== Day 17: Set and Forget

The original puzzle can be found at https://adventofcode.com/2019/day/17

== Star 1
For part1 I adapted my IntCode program to the output in ASCII and draw a field. Instead of then searching of the robot and programming an algorithm to follow the path and just count crossings, I scanned over the complete field, which was not efficient looking at part2, but it worked.

== Star 2
For part2 I tried to apply that track following algorithm but my approach led to to much if/else.., since it was very late in the evening and the path very short, I just evaluated the sequence by hand (L12, L8….). Even I do not know how to make a simple algorithm for sequencing the path in A, B, C, also this I did manually. All outputs are stored in column N, there the last entry will be the value looked for.
AoC_2019_day17_part1.xlsm
Unresolved directive in ../../../../../../day17/VBA/RJPlog/AoC_2019_day17_part1.xlsm - include::AoC_2019_day17_part1.xlsm[]

.AoC_2019_day17_part2.xlsm
[source]

include::AoC_2019_day17_part2.xlsm[]

:leveloffset: 12


++++
<a id="day19" />
++++

=== Day 19: VBA

:leveloffset: +2


[small]#this documentation is autogenerated. Add a `README.adoc` to your solution to take over the control of this :-)#

== VBA


.AoC_2019_day19_part2.xlsm
[source]

Unresolved directive in ../../../../../../day19/VBA/RJPlog/AoC_2019_day19_part2.xlsm - include::AoC_2019_day19_part2.xlsm[]

AoC_2019_day19.adoc
include::AoC_2019_day19.adoc[]
AoC_2019_day19_part1.xlsm
include::AoC_2019_day19_part1.xlsm[]
Day 20: VBA

this documentation is autogenerated. Add a README.adoc to your solution to take over the control of this :-)

VBA
AoC_2019_day20.adoc
== Day 20: Donut Maze

The original puzzle can be found at https://adventofcode.com/2019/day/20

== Star 1
tbfol (to be filled out later)

== Star 2
tbfol
AoC_2019_day20_part1.xlsm
Unresolved directive in ../../../../../../day20/VBA/RJPlog/AoC_2019_day20_part1.xlsm - include::AoC_2019_day20_part1.xlsm[]


:leveloffset: 14


++++
<a id="day21" />
++++

=== Day 21: VBA

:leveloffset: +2


[small]#this documentation is autogenerated. Add a `README.adoc` to your solution to take over the control of this :-)#

== VBA


.AoC_2019_day21_part1.xlsm
[source]

Unresolved directive in ../../../../../../day21/VBA/RJPlog/AoC_2019_day21_part1.xlsm - include::AoC_2019_day21_part1.xlsm[]

AoC_2019_day21.adoc
include::AoC_2019_day21.adoc[]
Day 22: VBA

this documentation is autogenerated. Add a README.adoc to your solution to take over the control of this :-)

VBA
AoC_2019_day22.adoc
== Day 22: Slam Shuffle

The original puzzle can be found at https://adventofcode.com/2019/day/22

== Star 1
tbfol (to be filled out later)

== Star 2
tbfol
AoC_2019_day22_part1.xlsm
Unresolved directive in ../../../../../../day22/VBA/RJPlog/AoC_2019_day22_part1.xlsm - include::AoC_2019_day22_part1.xlsm[]


:leveloffset: 16


++++
<a id="day23" />
++++

=== Day 23: VBA

:leveloffset: +2


[small]#this documentation is autogenerated. Add a `README.adoc` to your solution to take over the control of this :-)#

== VBA


.AoC_2019_day23_part1.xlsm
[source]

Unresolved directive in ../../../../../../day23/VBA/RJPlog/AoC_2019_day23_part1.xlsm - include::AoC_2019_day23_part1.xlsm[]

AoC_2019_day23.adoc
include::AoC_2019_day23.adoc[]
Day 24: VBA

this documentation is autogenerated. Add a README.adoc to your solution to take over the control of this :-)

VBA
AoC_2019_day24.adoc
== Day 24: Planet of Discord

The original puzzle can be found at https://adventofcode.com/2019/day/24

== Star 1


== Star 2
AoC_2019_day24_part1.xlsm
Unresolved directive in ../../../../../../day24/VBA/RJPlog/AoC_2019_day24_part1.xlsm - include::AoC_2019_day24_part1.xlsm[]


:leveloffset: 18


++++
<a id="day25" />
++++

=== Day 25: VBA

:leveloffset: +2


[small]#this documentation is autogenerated. Add a `README.adoc` to your solution to take over the control of this :-)#

== VBA


.AoC_2019_day25_part1.xlsm
[source]

Unresolved directive in ../../../../../../day25/VBA/RJPlog/AoC_2019_day25_part1.xlsm - include::AoC_2019_day25_part1.xlsm[]

AoC_2019_day25.adoc
include::AoC_2019_day25.adoc[]