1 import { Refusal1Rules
} from "@/variants/Refusal1";
3 export class Refusal2Rules
extends Refusal1Rules
{
5 // NOTE: do not take refusal move into account here (two own moves)
8 const color
= this.turn
;
9 for (let i
= 0; i
< V
.size
.x
; i
++) {
10 for (let j
= 0; j
< V
.size
.y
; j
++) {
11 if (this.board
[i
][j
] != V
.EMPTY
&& this.getColor(i
, j
) == color
) {
12 const moves
= this.getPotentialMovesFrom([i
, j
]);
13 for (let m
of moves
) {
14 if (m
.vanish
[0].c
== color
&& this.filterValid([m
]).length
> 0) {
16 if (movesCounter
>= 2) return true;
26 const L
= this.lastMove
.length
;
27 const lm
= this.lastMove
[L
-1];
29 // My previous move was already refused?
30 (!!lm
&& this.getColor(lm
.end
.x
, lm
.end
.y
) == this.turn
) ||
31 // I've only one move available?
32 !this.atLeastTwoMoves()
36 // NOTE: refusal could be recomputed, but, it's easier like this
37 if (move.vanish
[0].c
!= this.turn
) move.refusal
= true;