otakusenpai
01/30/2019, 1:03 PMPavlo Liapota
01/30/2019, 1:13 PMwhen
value to upper/lower case?
when(x.toLowerCase()) {
"abc" -> // ...
}
otakusenpai
01/30/2019, 1:16 PMotakusenpai
01/30/2019, 1:20 PMotakusenpai
01/30/2019, 1:22 PMhudsonb
01/30/2019, 1:24 PMPavlo Liapota
01/30/2019, 1:25 PMotakusenpai
01/30/2019, 1:26 PMotakusenpai
01/30/2019, 1:27 PMwhile((j<=64) && (i<= initialState.length)) {
var letter = blocks[0].get(i)
i++
file = 1 + ((j-1)%8)
rank = 8 - ((j-1)/8)
var pieceIndex = getPieceIndex(rank,file)
when(letter) {
'p' -> { // Pawn
fenData.boards.allPawns or getBitmask(pieceIndex)
fenData.boards.whitePieces or getBitmask(pieceIndex)
}
'P' -> {
fenData.boards.allPawns or getBitmask(pieceIndex)
fenData.boards.blackPieces or getBitmask(pieceIndex)
}
'r' -> { // Rook
fenData.boards.whitePieces or getBitmask(pieceIndex)
fenData.boards.allRooks or getBitmask(pieceIndex)
}
'R' -> {
fenData.boards.blackPieces or getBitmask(pieceIndex)
fenData.boards.allRooks or getBitmask(pieceIndex)
}
'n' -> { // Knight
fenData.boards.whitePieces or getBitmask(pieceIndex)
fenData.boards.allKnights or getBitmask(pieceIndex)
}
'N' -> {
fenData.boards.blackPieces or getBitmask(pieceIndex)
fenData.boards.allKnights or getBitmask(pieceIndex)
}
'b' -> { // Bishop
fenData.boards.whitePieces or getBitmask(pieceIndex)
fenData.boards.allBishops or getBitmask(pieceIndex)
}
'B' -> {
fenData.boards.blackPieces or getBitmask(pieceIndex)
fenData.boards.allBishops or getBitmask(pieceIndex)
}
'q' -> { // Queen
fenData.boards.whitePieces or getBitmask(pieceIndex)
fenData.boards.allQueens or getBitmask(pieceIndex)
}
'Q' -> {
fenData.boards.allQueens or getBitmask(pieceIndex)
fenData.boards.blackPieces or getBitmask(pieceIndex)
}
'k' -> { // Kings
fenData.boards.allKings or getBitmask(pieceIndex)
fenData.boards.whitePieces or getBitmask(pieceIndex)
}
'K' -> {
fenData.boards.allKings or getBitmask(pieceIndex)
fenData.boards.blackPieces or getBitmask(pieceIndex)
}
// -----------------------------------------------------
'/' -> j--
'2' -> j++
'3' -> j+=2
'4' -> j+=3
'5' -> j+=4
'6' -> j+=5
'7' -> j+=6
'8' -> j+=7
else -> return -1
}
}
otakusenpai
01/30/2019, 1:28 PMPavlo Liapota
01/30/2019, 1:31 PMwhen(letter) {
'a', 'A' -> // ...
'b', 'B' -> // ...
}
Ratosh
01/30/2019, 1:31 PMotakusenpai
01/30/2019, 1:40 PMotakusenpai
01/30/2019, 1:42 PMRatosh
01/30/2019, 2:12 PMAlowaniak
01/30/2019, 3:18 PM'1' -> Unit
?