Compare commits

..

2 Commits

Author SHA1 Message Date
b12bf04f91 d21p2: clean up code and properly calculate previously manually-determined best key sequences 2024-12-22 15:27:14 -08:00
4c68223c42 d22p2 2024-12-22 11:11:59 -08:00

View File

@@ -8,7 +8,7 @@ func readInput(_ filePath: String) throws -> [Int] {
func haggle(_ seeds: [Int]) -> [[Int]: [Int: Int]] {
var bananas: [[Int]: [Int: Int]] = [:]
for (monkey, seed) in seeds.enumerated() {
var prevs = [monkey, seed, Int.min, Int.min]
var prevs = [Int.min, Int.min, Int.min, Int.min]
var lastPrice = seed
for _ in 0..<2000 {
var price = ((lastPrice << 6) ^ lastPrice) & 16777215