General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2023 Day 7 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

Discussion thread for day 7 of the Advent of Code - https://adventofcode.com/2023/day/7

39 REPLIES 39
JarrodT
Alteryx
Alteryx

Not the prettiest, but it works. Had fun thinking through Part 2 combinations

Spoiler
 

image.png

gawa
15 - Aurora
15 - Aurora

There were a pit fall for me even in part 1, and took a bit long but get it done

Spoiler
image.png
AndrewDMerrill
13 - Pulsar

Tried to pretty up my solutions before posting (still not lookers, but much better than when they started):

Spoiler
Screenshot.png

 

ScottLewis
8 - Asteroid

I usually try to bash through these without planning, which is terrible form in the real world but this isn't there. I end up with ugly but functional workflows with a lot more pieces than would be needed if I took my time. Lots of path for each case where a well applied multifield/tile/etc. could handle many cases at once. Still, work is work:


Pang_Hee_Choy
12 - Quasar

keep forget the requirement...

 

Spoiler
forget sort by A > K > Q > .. > 2
forget sort descending
forget part 2: is A > ... 2 > J and etc...

workflow
Screenshot 2023-12-07 142933.png

tokenize and group by cards, then crosstab with count of card.
it show as below, each column is count of 1 of kind, 2 of kind, 3 of kind, 4 of kind and 5 of kind. (joker is part 2, split for ease calculate)

e.g. count_2 = 1 mean 1 pairs or 2 cards.
e.g. count_3 = 1 mean 1 three of kind or 3 cards.
Screenshot 2023-12-07 143401.png
for sorting, i create a table then use find and replace to replace with card value. for ease of sort later.
Screenshot 2023-12-07 143020.png
example result before sum, the "sorting" column is converted from table above for sorting.
Screenshot 2023-12-07 143212.png
for part 2, I try to generate a formula for it. but i think it better to manual generate a table for each kind of situation. and it work perfectly. 
Screenshot 2023-12-07 143008.png
DaisukeTsuchiya
13 - Pulsar

Today's one is interesting.

Spoiler
スクリーンショット 2023-12-07 160832.png
Watermark
12 - Quasar
12 - Quasar

 

The 2 are almost the same, slight tweak for an extra stream to handle the Jacks.

I handled it essentially as 2 pieces.  'hand ranking', ignoring what the cards 'are' only how many of the same. Then 'sorting' based on actual card values. 

 

Spoiler
AOC 2023 Day 7P1.jpg


AOC 2023 Day 7P2.jpg

 

Tokimatsu
12 - Quasar

I misunderstood the requirement.

Spoiler
I thought that with pairs, the one with the stronger pair number would win.
スクリーンショット 2023-12-07 160600.png

cgoodman3
14 - Magnetar
14 - Magnetar
Spoiler
day7_2023.pngI struggled with the question logic, as I was trying to work out why if K>T why they would be ordered the way they did, so lots of re-reading and working it out.

My approach was:
1) Split the cards to rows then assign a value 1-12 for 2 - A
2) Map the cards to the type of hand for example 5 card of 1 type = five of a kind, 3 of one card and 2 individuals were three of a kind etc, to give the hand strength
3) Replace TJQKA with ABCDE with the original hand order which when combined with hand strength gave the ability to sort matching hands based on the strongest first card (again was struggling with the logic compared to real poker)

For part 2
1) Isolated hands with Jacks, then appended all combinations and followed the same logic as above to find the strongest hand 
2) Replaced this with the original set
3) Modified Jacks to 0 instead of B for the sorting
 
Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
Labels