diff --git a/Sources/AOC2018/tools.swift b/Sources/AOC2018/tools.swift index 87ddc15..1870f23 100644 --- a/Sources/AOC2018/tools.swift +++ b/Sources/AOC2018/tools.swift @@ -19,9 +19,14 @@ func == (tuple1:(T,T),tuple2:(T,T)) -> Bool return (tuple1.0 == tuple2.0) && (tuple1.1 == tuple2.1) } -struct GridPoint: Equatable, Comparable { +struct GridPoint: Equatable, Comparable, Hashable { var X = 0 var Y = 0 + var hashValue: Int { + get { + return X.hashValue ^ Y.hashValue + } + } static func == (lhs: GridPoint, rhs: GridPoint) -> Bool { return (lhs.X == rhs.X) && (lhs.Y == rhs.Y)