Title
d

Davio

12/07/2023, 10:16 AM
I'm 99% sure my implementation for part 1 is correct, it works for the test and when I manually check my hand ranks and their ordering, it also looks correct, but AoC thinks it's too high, does anybody have an input with a known good answer I can check against maybe? Perhaps I've misinterpreted something
o

Ozioma Ogbe

12/07/2023, 10:20 AM
With the test input if you mess up the ordering, you still get the same.
So check that you actually mapped full house to the highest
And also that you have 2 as the lowest and A the highest in your sorting
I can share some test cases I built when I get on my laptop.
r

Riccardo Lippolis

12/07/2023, 10:32 AM
just to be sure: are you using Longs? (I needed longs instead of ints) (depending on your solution this might not apply to you)
a

Artemiy Smirnov

12/07/2023, 10:46 AM
j

Jakub Gwóźdź

12/07/2023, 12:42 PM
@Davio I was sure too, because I implemented card ordering as in normal poker (e.g.
``37573``
became
``77335``
and
``56363``
became
``66335``
). Such poker ordering works for test input, but not for the real one. then after a_few_hours_later.gif I finally read the puzzle text 😕
d

Davio

12/07/2023, 12:57 PM
Ok it works with the edge case list from @Artemiy Smirnov, but still not with the actual input, even more confused now
input.txt
🙌 1
I get
``248881764``
for part 1 with this input
r

Riccardo Lippolis

12/07/2023, 1:05 PM
I'm getting
``248453531``
1
d

Davio

12/07/2023, 1:05 PM
I think I found it, missed one possible combination of forming 2 pairs
What I basically do is to first sort the cards in the hand and then find the strength in a very naive way, so checking whether card1 == card2 and for 2 pair there are 3 possibilities for the non-pairing card, it's either at index 0, 2 or 4
m

Martin Harvan

12/07/2023, 1:39 PM
@Davio I had similar issue, but in my case it was 1. I misread the instructions and I was actually comparing the incorrect cards (I was taking the ones that had most cards e.g. 3 of a kind cards) 2. copy paste error, I was returning incorrect value for T (instead of 10, I was returning 11 - same as J).
d

Davio

12/07/2023, 6:06 PM
I got it for both parts now, not really pretty, but for part 2 I just go from A - 2, replacing any J with it (so also with itself) and grabbing the max strength (so for 222JJ it would be five of a kind with the J as a 2 and for J2233 it would be a full house with the J as a 3)
c

Charles Flynn

12/07/2023, 6:43 PM
Today's test input felt particularly unhelpful today in terms of giving false positives
true story 1
3 Views