                 board[g8] == nil &&
                 board[h8] == BR
             {
-                result.append(.castleKingside(player: player))
+                moves.append(.castleKingside(player: player))
             }
 
             if blackCanCastleQueenside &&

        (1, -1), (-1, -1)
    ]

    private func queenMoves(piece: Piece, location: Location) -> [Move] {
        return slideMoves(piece: piece,
                          location: location,
                          vectors: Position.eightDirections)
    }

    // MARK:- King

    private func kingMoves(piece: Piece, location: Location) -> [Move] {
        let file = location.file
        let rank = location.rank
        let player = piece.player

        var result = [Move]()
        result.reserveCapacity(10)

        for (h, v) in Position.eightDirections {
            if let targetLocation = Location.ifValid(file: file + h, rank: rank + v) {
                if let occupant = board[targetLocation] {
                    if occupant.player != player {
                        result.append(.capture(piece: piece,
                                               from: location,
                                               to: targetLocation,
                                               captured: occupant.kind))
                    }
                }
                else {
                    result.append(.move(piece: piece, from: location, to: targetLocation))
                }
            }
        }

                board[g1] == nil &&
                board[h1] == WR
            {
                moves.append(.castleKingside(player: player))
            }

            if whiteCanCastleQueenside &&
