This commit is contained in:
cdricms
2024-06-25 18:08:25 +02:00
commit c36319d4d7
12 changed files with 495 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
public struct Square: Equatable {
public struct Position: Equatable {
public let file: UInt8
public let rank: UInt8
public var index: Int {
return Int(file * rank) - 1
}
public static func == (lhs: Position, rhs: Position) -> Bool {
return lhs.rank == rhs.rank && lhs.file == rhs.file
}
}
public let position: Position
public let index: UInt8
public var piece: Piece? = nil
public let color: Color
public static func == (lhs: Square, rhs: Square) -> Bool {
return lhs.position == rhs.position
}
}