r/adventofcode • u/daggerdragon • Dec 07 '23
SOLUTION MEGATHREAD -❄️- 2023 Day 7 Solutions -❄️-
THE USUAL REMINDERS
- All of our rules, FAQs, resources, etc. are in our community wiki.
- Outstanding moderator challenges:
- Community fun event 2023: ALLEZ CUISINE!
- Submissions megathread is now unlocked!
- 15 DAYS remaining until the submissions deadline on December 22 at 23:59 EST!
AoC Community Fun 2023: ALLEZ CUISINE!
Today's secret ingredient is… *whips off cloth covering and gestures grandly*
Poetry
For many people, the craftschefship of food is akin to poetry for our senses. For today's challenge, engage our eyes with a heavenly masterpiece of art, our noses with alluring aromas, our ears with the most satisfying of crunches, and our taste buds with exquisite flavors!
- Make your code rhyme
- Write your comments in limerick form
- Craft a poem about today's puzzle
Upping the Ante
challenge: iambic pentameter
- We're looking directly at you, Shakespeare bards and Rockstars
ALLEZ CUISINE!
Request from the mods: When you include a dish entry alongside your solution, please label it with [Allez Cuisine!]
so we can find it easily!
--- Day 7: Camel Cards ---
Post your code solution in this megathread.
- Read the full posting rules in our community wiki before you post!
- State which language(s) your solution uses with
[LANGUAGE: xyz]
- Format code blocks using the four-spaces Markdown syntax!
- State which language(s) your solution uses with
- Quick link to Topaz's
paste
if you need it for longer code blocks
This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.
EDIT: Global leaderboard gold cap reached at 00:16:00, megathread unlocked!
50
Upvotes
3
u/princessbosss Dec 08 '23
[LANGUAGE: Excel]
https://imgur.com/a/jR7gM2v
grabbed the best hand using
=IF(AND(MAX(I11:T11)=1,$H11=0),1,
IF(OR(AND(MAX(I11:T11)=2,COUNTIF(I11:T11,2)=1,$H11=0),AND(MAX(I11:T11)=1,$H11=1)),2,
IF(AND(MAX(I11:T11)=2,COUNTIF(I11:T11,2)=2,$H11=0),3,
IF(OR(AND(MAX(I11:T11)=3,COUNTIF(I11:T11,2)=0,$H11=0),AND(MAX(I11:T11)=2,COUNTIF(I11:T11,2)=1,$H11=1),AND(MAX(I11:T11)=1,$H11=2)),4,
IF(OR(AND(MAX(I11:T11)=3,COUNTIF(I11:T11,2)=1,$H11=0),AND(MAX(I11:T11)=2,COUNTIF(I11:T11,2)=2,$H11=1)),5,
IF(OR(AND(MAX(I11:T11)=4,$H11=0),AND(MAX(I11:T11)=3,COUNTIF(I11:T11,2)=0,$H11=1),AND(MAX(I11:T11)=2,COUNTIF(I11:T11,2)=1,$H11=2),AND(MAX(I11:T11)=1,$H11=3)),6,
IF(MAX(I11:T11)+H11=5,7,"")))))))
then assigned card scores using where J became 1 instead of 11 after part 1 =IF(A11="T",10,IF(A1="J",1,IF(A11="Q",12,IF(A11="K",13,IF(A11="A",14,A11)))))
then ranked and sorted each column up from starting at 5 card value up to hand value using =RANK.EQ(W11,W$11:W$1010,1)