removes more warnings
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@ fun TagArray.isTaggedAddressableKind(kindStr: String) = this.any(ATag::isTaggedW
|
|||||||
|
|
||||||
fun TagArray.getTagOfAddressableKind(kind: Int) = this.fastFirstNotNullOfOrNull(ATag::parseIfOfKind, kind.toString())
|
fun TagArray.getTagOfAddressableKind(kind: Int) = this.fastFirstNotNullOfOrNull(ATag::parseIfOfKind, kind.toString())
|
||||||
|
|
||||||
fun TagArray.getTagOfAddressableKind(kindStr: String) = this.fastFirstNotNullOfOrNull(ATag::parseIfOfKind, kindStr.toString())
|
fun TagArray.getTagOfAddressableKind(kindStr: String) = this.fastFirstNotNullOfOrNull(ATag::parseIfOfKind, kindStr)
|
||||||
|
|
||||||
fun TagArray.taggedATags() = this.mapNotNull(ATag::parse)
|
fun TagArray.taggedATags() = this.mapNotNull(ATag::parse)
|
||||||
|
|
||||||
|
|||||||
+6
-7
@@ -119,7 +119,6 @@ actual class ChessEngine {
|
|||||||
val sq = Square.fromValue(square.uppercase())
|
val sq = Square.fromValue(square.uppercase())
|
||||||
return board
|
return board
|
||||||
.legalMoves()
|
.legalMoves()
|
||||||
.filterNotNull()
|
|
||||||
.filter { it.from == sq }
|
.filter { it.from == sq }
|
||||||
.map { it.to.toString().lowercase() }
|
.map { it.to.toString().lowercase() }
|
||||||
}
|
}
|
||||||
@@ -132,7 +131,7 @@ actual class ChessEngine {
|
|||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (_: Exception) {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +155,7 @@ actual class ChessEngine {
|
|||||||
|
|
||||||
val move = Move(fromSquare, toSquare, promotionPiece)
|
val move = Move(fromSquare, toSquare, promotionPiece)
|
||||||
board.legalMoves().contains(move)
|
board.legalMoves().contains(move)
|
||||||
} catch (e: Exception) {
|
} catch (_: Exception) {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +191,7 @@ actual class ChessEngine {
|
|||||||
val toSquare = move.to
|
val toSquare = move.to
|
||||||
val piece = board.getPiece(fromSquare)
|
val piece = board.getPiece(fromSquare)
|
||||||
val pt = piece.pieceType ?: return move.toString()
|
val pt = piece.pieceType ?: return move.toString()
|
||||||
val promotionPiece = move.promotion ?: Piece.NONE
|
val promotionPiece = move.promotion
|
||||||
|
|
||||||
// Castling
|
// Castling
|
||||||
if (pt == com.github.bhlangonijr.chesslib.PieceType.KING) {
|
if (pt == com.github.bhlangonijr.chesslib.PieceType.KING) {
|
||||||
@@ -213,7 +212,7 @@ actual class ChessEngine {
|
|||||||
board.getPiece(toSquare) != Piece.NONE ||
|
board.getPiece(toSquare) != Piece.NONE ||
|
||||||
(
|
(
|
||||||
pt == com.github.bhlangonijr.chesslib.PieceType.PAWN &&
|
pt == com.github.bhlangonijr.chesslib.PieceType.PAWN &&
|
||||||
epTarget != null && epTarget != Square.NONE && toSquare == epTarget
|
epTarget != Square.NONE && toSquare == epTarget
|
||||||
)
|
)
|
||||||
|
|
||||||
if (pt != com.github.bhlangonijr.chesslib.PieceType.PAWN) {
|
if (pt != com.github.bhlangonijr.chesslib.PieceType.PAWN) {
|
||||||
@@ -221,7 +220,7 @@ actual class ChessEngine {
|
|||||||
|
|
||||||
// Disambiguation: check if other pieces of same type can reach the same square
|
// Disambiguation: check if other pieces of same type can reach the same square
|
||||||
val ambiguous =
|
val ambiguous =
|
||||||
board.legalMoves().filterNotNull().filter {
|
board.legalMoves().filter {
|
||||||
it.to == toSquare &&
|
it.to == toSquare &&
|
||||||
board.getPiece(it.from).pieceType == pt &&
|
board.getPiece(it.from).pieceType == pt &&
|
||||||
it.from != fromSquare
|
it.from != fromSquare
|
||||||
@@ -342,7 +341,7 @@ actual class ChessEngine {
|
|||||||
blackKingSide = board.castleRight.toString().contains("k"),
|
blackKingSide = board.castleRight.toString().contains("k"),
|
||||||
blackQueenSide = board.castleRight.toString().contains("q"),
|
blackQueenSide = board.castleRight.toString().contains("q"),
|
||||||
),
|
),
|
||||||
enPassantSquare = board.enPassantTarget?.let { it.toString().lowercase() },
|
enPassantSquare = board.enPassantTarget.toString().lowercase(),
|
||||||
halfMoveClock = board.halfMoveCounter,
|
halfMoveClock = board.halfMoveCounter,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user