Discussion thread for day 7 of the Advent of Code - https://adventofcode.com/2023/day/7
Not the prettiest, but it works. Had fun thinking through Part 2 combinations
There were a pit fall for me even in part 1, and took a bit long but get it done
Tried to pretty up my solutions before posting (still not lookers, but much better than when they started):
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:
keep forget the requirement...
Today's one is interesting.
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.
I misunderstood the requirement.
This was a really fun puzzle!
I've pretty much given up on trying use fewer tools, at this point 😅 But this was a really fun one, I'm really pleased I got it!
Edit: it's fascinating to see how many different approaches there are in this thread!!
My solution.
Today, I couldn't perform as well as I could because I have some work. So, I took so much time for part 2 due to a small mistake.
My Designer Cloud solution.
I was surprised at the difference of the Find Replace tool.
And I optimize my Designer Desktop workflow.
Not winning any tool golf here but very much enjoyed today's challenge! Part 2 was interesting to work through.
I thought I had a good workflow going until I found buried in the documentation that Mode calculation selects the lowest number when there is a tie. This is a good use case where Alteryx should have an option to pick MaxMode or MinMode in the Summarize Tool when there are more than one Mode.
Probably not the straightest path there but it worked.
@patrick_digan wrote: Probably not the straightest path there but it worked.
If you use Ctrl Shift + it would be a straighter path 😉
It's not pretty, but it worked. I edited part 2 right on top of part 1, so this won't work for part 1.
Tried to get too cute on p2 and simplified it.
My Solution:
Solved! That was a fun one. I ended up with a very bizarre detour with a couple of Multi-Rows to handle the Jokers and getting them sorted properly
Fortunately I was able to use most of my solution for part 1 for part 2. Detour tools for the win!
Another easy one today...
if [No. Jacks]=0 THEN [Hand Rank]
ELSEIF [Hand Rank]=1 then 1
elseif [Hand Rank]=2 AND [No. Jacks]>0 then 1
elseif [Hand Rank]=3 AND [No. Jacks]>0 then 1
elseif [Hand Rank]=4 AND [No. Jacks]>0 THEN 2
elseif [Hand Rank]=5 AND [No. Jacks]=1 then 3elseif [Hand Rank]=5 AND [No. Jacks]=2 then 2
elseif [Hand Rank]=6 AND [No. Jacks]=1 then 4elseif [Hand Rank]=6 AND [No. Jacks]=2 then 4
elseif [Hand Rank]=7 AND [No. Jacks]=1 then 6
ELSE [Hand Rank] ENDIFand the card score was adjusted in the text input.
So there you go, @phottovy , enjoy!
I didn't over think and over engineer my solution to today's problem and anyone who says any different is a big fat liar!!!!!!!!!!!!!!!!!!!!
Tool golf version: total 13 tools
Calculate the type by Regex, and convert data into Hexa-decimal, and sort.
That was a fun one!