|
|
|
@ -135,4 +135,21 @@ function getCasualties(oldX, oldY, newX, newY) { |
|
|
|
return casualties; |
|
|
|
return casualties; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function canContinue(pieceRecord){ |
|
|
|
|
|
|
|
const x = pieceRecord.x; |
|
|
|
|
|
|
|
const y = pieceRecord.y; |
|
|
|
|
|
|
|
const player = pieceRecord.player; |
|
|
|
|
|
|
|
const type = pieceRecord.type; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if((type == "queen" || player == "white") && (getCasualties(x+1, y+1, x+2, y+2).count() == 1 || getCasualties(x-1, y+1, x-2, y+2).count() == 1)){ |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if((type == "queen" || player == "black") && (getCasualties(x+1, y-1, x+2, y-2).count() == 1 || getCasualties(x-1, y-1, x-2, y-2).count() == 1)){ |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
generateDefaultPositions(); |
|
|
|
generateDefaultPositions(); |