         public init(board: Board = Board(),
                     playerTurn: PlayerTurn = .White,
                     castlingAvailability: CastlingAvailability = .all,
-                    enPassantTarget: Location? = nil,
+                    enPassantTarget: Square? = nil,
                     halfmoves: UInt = 0,
                     fullmoves: UInt = 1) {
             self.board = board

        public func fen() -> String {
            return board.fen()
                + " \(playerTurn.isWhite ? "w" : "b") \(castlingAvailability) "
                + (enPassantTarget.map({ f, r in "\(f)\(r)".lowercaseString }) ?? "-")
                + " \(halfmoves) \(fullmoves)"
        }


                let halfmoves = UInt(parts[4]),
                let fullmoves = UInt(parts[5]) where fullmoves > 0
                else { return nil }
            var target: Square? = nil
            let targetStr = parts[3]
            let targetChars = targetStr.characters
            if targetChars.count == 2 {
                guard let square = Square.init(targetStr) else {
                    return nil
                }
                target = square
            } else {
                guard targetStr == "-" else {
                    return nil
