Compare commits

..

2 Commits

Author SHA1 Message Date
2c03c77ff6 d21p2: clean up code and properly calculate previously manually-determined best key sequences 2024-12-22 18:53:18 -08:00
7ea4390d3d d22p2 2024-12-22 18:53:16 -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 = [Int.min, Int.min, Int.min, Int.min]
var prevs = [monkey, seed, Int.min, Int.min]
var lastPrice = seed
for _ in 0..<2000 {
var price = ((lastPrice << 6) ^ lastPrice) & 16777215