- i -= step[0];
- j -= step[1];
- }
- if (i>=0 && i<sizeX && j>=0 && j<sizeY && colors.includes(this.getColor(i,j))
- && this.getPiece(i,j) == V.KNIGHT)
- {
- if (!this.isImmobilized([i,j]))
- return true;
+ while (i>=0 && i<sizeX && j>=0 && j<sizeY && this.board[i][j] == V.EMPTY)
+ {
+ i -= step[0];
+ j -= step[1];
+ }
+ if (i>=0 && i<sizeX && j>=0 && j<sizeY)
+ {
+ if (colors.includes(this.getColor(i,j)))
+ {
+ if (this.getPiece(i,j) == V.KNIGHT && !this.isImmobilized([i,j]))
+ return true;
+ continue outerLoop;
+ }
+ // [else] Our color, could be captured
+ i -= step[0];
+ j -= step[1];
+ }