Skip to content

Commit

Permalink
fix(hot): king check defended by protectors
Browse files Browse the repository at this point in the history
  • Loading branch information
Yash7824 committed May 6, 2024
1 parent e0ee139 commit a024406
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions client/src/app/services/generic-rule.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1150,17 +1150,19 @@ export class GenericRuleService {
debugger;
if (fromRow == toRow && fromCol == toCol) return true;

if(this.IsWhitePiece(fromRow, fromCol)){
if(this.IsKingUnderCheckAfterPieceMovement('K', fromRow, fromCol, toRow, toCol, this.chess_Board)){
if(this.IsWhitePiece(fromRow, fromCol)){

}
}

if(this.IsWhitePiece(fromRow, fromCol) && this.chess_Board[fromRow][fromCol] !== 'K'){
if(this.IsKingUnderCheckAfterPieceMovement('k', fromRow, fromCol, toRow, toCol, this.chess_Board)){
return false;
}else if(this.IsKingUnderCheckAfterPieceMovement('K', fromRow, fromCol, toRow, toCol, this.chess_Board)){
return true;
}
}else if(this.IsBlackPiece(fromRow, fromCol)){
}else if(this.IsBlackPiece(fromRow, fromCol) && this.chess_Board[fromRow][fromCol] !== 'k'){
if(this.IsKingUnderCheckAfterPieceMovement('K', fromRow, fromCol, toRow, toCol, this.chess_Board)){
return false;
}else if(this.IsKingUnderCheckAfterPieceMovement('k', fromRow, fromCol, toRow, toCol, this.chess_Board)){
return true;
}
}

Expand Down

0 comments on commit a024406

Please sign in to comment.