day7: Remove some spurious comments

This commit is contained in:
Tristan Daniël Maat 2023-12-07 18:23:16 +01:00
parent b1167fe42e
commit 5674535478
Signed by: tlater
GPG key ID: 49670FD774E43268

View file

@ -17,12 +17,6 @@ fun part1(bets: List<Pair<Hand, Int>>): Int {
} }
fun part2(bets: List<Pair<Hand, Int>>): Int { fun part2(bets: List<Pair<Hand, Int>>): Int {
// println(
// bets.sortedBy { handValueJoker(it.first) }.forEach {
// println("${it} - ${handValueJoker(it.first)}")
// }
// )
return bets.sortedBy { handValueJoker(it.first) }.foldIndexed(0) { i, acc, bet -> return bets.sortedBy { handValueJoker(it.first) }.foldIndexed(0) { i, acc, bet ->
acc + (i + 1) * bet.second acc + (i + 1) * bet.second
} }
@ -120,7 +114,6 @@ fun handValueJoker(cards: Hand): Int {
// Since the tie breaker in this case is again the value of the // Since the tie breaker in this case is again the value of the
// card, this is kind of recursive. // card, this is kind of recursive.
return typeJoker(cards) + cards.fold(0) { acc, label -> acc * 13 + cardValueJoker(label) } return typeJoker(cards) + cards.fold(0) { acc, label -> acc * 13 + cardValueJoker(label) }
// 247838255 is too low
} }
fun parseHands(input: File): List<Pair<Hand, Int>> { fun parseHands(input: File): List<Pair<Hand, Int>> {