We have extended our Early Bird Tickets for Inspire 2023! Discounted pricing goes until February 24th. Save your spot!

alteryx Community

# General Discussions

Discuss any topics that are not product-specific here.

## Advent of Code 2022 Day 22 (BaseA Style)

Alteryx Community Team
Discussion thread for day 22 of the Advent of Code - https://adventofcode.com/2022/day/22
8 REPLIES 8
8 - Asteroid

Most of P1 was spent setting up the problem (more in the spoiler). I'll need to get my head wrapped around P2

Spoiler
1. Setup coordinate so each point has 4 adjacent points defined to account for empty space/falling off map
2. Generate direction and I used 360 degree calcs to determine overall direction

3. I macro for path

16 - Nebula

Part 1 done! Part 2 looks like it'll take me a good while to wrap my head around so will come back to update this if I ever get round to finishing it!

Spoiler
Workflow:

Macro:

Just for fun - my rough path. Obviously can't show wrapping too well:

... Eric really loves his position-based problems!

6 - Meteoroid

So tell me that what is the Advent of Code 2022 Day 22.

Discussion thread for day 22 of the Advent of Code - https://adventofcode.com/2022/day/22
13 - Pulsar

The below link will give more insights to you.

Many thanks

Shanker V

17 - Castor

Ha so I spent forever coding up part2 but thankfully it worked.

Spoiler
Definitely a slow and steady approach moving a single cell each iteration.

16 - Nebula

Finally done.

Spoiler
I solved part 1 straight forward.
But it took long time to solve part 2 because debugging is too difficult more than part 1.

Firstly I tried to solve part 2 by modifying the part 1 macro but failed because my part 1 macro is dirty and inefficient. So I remake the macro for part 2 which is simple and clean. After that, I compared the results of 2 version macro and finished debugging.

And I also created the following to help debug(I printed this image and acctually assembled it).

And I made the following table from above image.

 Direction Current Area Target Area Direction in new area axis direction x in new area y in new area R A D L reverse 100 150-y+1 R C A U y+50 50 R D A L reverse 150 150-y+1 R F D U y-100 150 L B E R reverse 1 150-y+1 L C E D y+50 101 L E B R reverse 51 150-y+1 L F B D y-100 1 U A F U x-100 200 U B F R reverse 1 150-y+1 U E C R 51 x+50 D A C L 100 x-50 D D F L 50 y+100 D F A D x 200

Part 1 macro: dirty, inefficient and slow macro

Part 2 macro : efficiently, simple and fast. This is only for my input. If it is the same as my cubic development, it will work well.

13 - Pulsar

I had to fold the cube on paper before I understood how to program part 2.

Workflows available here: https://github.com/clmc9601/Advent-of-Code-solutions/tree/main/2022%20Alteryx

Spoiler
My approach was to create all of the consecutive coordinates based on the instructions, then cut the movement off once it reached a wall. I wrapped the movement around based on min and max row and column coordinates. For Part 2, I basically created a coordinate conversion table to translate between absolute map coordinates and relative coordinates for rotating around the cube. I made one mistake in Part 2 that took several weeks to solve: I originally precalculated the facing direction. This became problematic when the directions "switch" around the cube. To correct it, I needed to calculate direction based on the previous iteration's direction.

Main workflowIterative macroWorkflow to create the conversion tableInput code in sectionsInput code as on a flattened cube (referenced in the conversion table workflow)

10 - Fireball

take few days. and finally get it.

Spoiler
part1: easy with min and max for x and y.

part2: view lot of post still can't figure out. the last mile, the formula mistake.

do the most stupid way. hardcode all the next step for all transition. point the corner for ease of imagine.

so from,

1st round: A move to B,
become,
1st round: A move till transit point, adjust face
2nd round: transit point move to B.

it takes slightly more time but easier to check.
Labels