- // TODO:::::: under sentry attack?!
- // Is piece (or square) at given position attacked by "oppCol(s)" ?
- underAttack([x, y], oppCols) {
- super.underAttack([x, y], oppCols)
- // An empty square is considered as king,
- // since it's used only in getCastleMoves (TODO?)
- const king = this.board[x][y] == "" || this.isKing(x, y);
- return (
- (
- (!this.options["zen"] || king) &&
- this.findCapturesOn(
- [x, y],
- {
- byCol: oppCols,
- one: true
- }
- )
- )
- ||
- (
- (!!this.options["zen"] && !king) &&
- this.findDestSquares(
- [x, y],
- {
- attackOnly: true,
- one: true
- },
- ([i1, j1], [i2, j2]) => oppCols.includes(this.getColor(i2, j2))
- )
- )
- );
- }
-
-
- // TODO::: sentry subturn ???
- // 'color' arg because some variants (e.g. Refusal) check opponent moves