Unable to load image

rDrama Advent of Code Day 10: Pipe ( | ) edition

Summary for those just joining us:

Advent of Code is an annual Christmas themed coding challenge that runs from December 1st until christmas. Each day the coding problems get progressively harder. We have a leaderboard and pretty good turnout, so feel free to hop in at any time and show your stuff!

Whether you have a single line monstrosity or a beautiful phone book sized stack of OOP code, you can export it in a nice little image for sharing at https://carbon.vercel.app

What did you think about today's problem?

https://adventofcode.com/2023

Our Code is 2416137-393b284c (No need to share your profile, you have the option to join anonymously if you don't want us to see your github)

15
Jump in the discussion.

No email address required.

I probably won't continue if the difficulty keeps ramping up. I have too much work to spend that much time on it every day, plus Nim doesn't have a great library ecosystem to solve these problems.

Part 1 was alright:

https://i.rdrama.net/images/17022220716401334.webp

Part 2 was an abomination, half nim, half python, half Gimp.

1. Found the path in Nim and create a new input file with all non-path tiles zeroed out.

2. Used a python script to draw an image upscaled 3 times (140x3, 140x3), where each 3x3 pixels corresponds to a pipe pattern or a 3x3 red dot for non-pipes.

3. In Gimp bucket fill the outer wall, bucket fill the inner wall , select all pixels in inner wall, remove holes in selection (captures the non-pipes pixels), subtract a selection of the inner wall.

4. Read number of pixels in selection and divide by 9.

https://i.rdrama.net/images/17022259244243233.webp

Prettier colours:

https://i.rdrama.net/images/17022309479630516.webp

Jump in the discussion.

No email address required.

https://i.rdrama.net/images/1702237146626357.webp

  • Operator overloading: Like most other languages, but with slightly better syntax. In addition, there are 19 different operator characters you can use to create arbitrary operators.

  • Stropping: Keywords like proc can be used as identifier names by enclosing them in backticks.

  • set vs std/sets: set is for ordinal types with <=2^16 possible values, because "sets are implemented as high performance bit vectors."

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.