I'm 99% sure my implementation for part 1 is corre...
# advent-of-code
d
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
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
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
j
@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
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
I'm getting
248453531
1
d
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
@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
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
Today's test input felt particularly unhelpful today in terms of giving false positives
true story 1