diff --git a/day19/d19p1.swift b/day19/d19p1.swift index 91f794e..1d1d238 100644 --- a/day19/d19p1.swift +++ b/day19/d19p1.swift @@ -1,27 +1,17 @@ import Foundation -enum Color: Character, CustomStringConvertible { - case r = "r" - case g = "g" - case u = "u" - case w = "w" - case b = "b" - var description: String { return String(self.rawValue) } -} +typealias Color = Character func readInput(_ filePath: String) throws -> ([[Color]], [[Color]]) { let content = try String(contentsOfFile: filePath, encoding: .ascii) let lines = content.split(separator: "\n") - let towels = lines[0].split(separator: ", ").map { $0.compactMap(Color.init) } - let patterns = lines[1.. Bool { - if pattern.count == 0 { - return true - } if let cached = cache[pattern] { return cached }