Fix bug (#2643)
This commit is contained in:
parent
00d79487cd
commit
e34b264af2
1 changed files with 2 additions and 2 deletions
|
@ -260,6 +260,8 @@ export default class Reversi {
|
|||
const found: number[] = []; // 挟めるかもしれない相手の石を入れておく配列
|
||||
let [x, y] = this.transformPosToXy(initPos);
|
||||
while (true) {
|
||||
[x, y] = nextPos(x, y);
|
||||
|
||||
// 座標が指し示す位置がボード外に出たとき
|
||||
if (this.opts.loopedBoard) {
|
||||
x = ((x % this.mapWidth) + this.mapWidth) % this.mapWidth;
|
||||
|
@ -281,8 +283,6 @@ export default class Reversi {
|
|||
if (stone === null) return []; // 挟めないことが確定 (石が置かれていないマスに到達)
|
||||
if (stone === enemyColor) found.push(pos); // 挟めるかもしれない (相手の石を発見)
|
||||
if (stone === color) return found; // 挟めることが確定 (対となる自分の石を発見)
|
||||
|
||||
[x, y] = nextPos(x, y);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue