From e34b264af2e859d9615d6d5308b7fe1bb1b00be8 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Fri, 7 Sep 2018 00:03:44 +0900 Subject: [PATCH] Fix bug (#2643) --- src/games/reversi/core.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/games/reversi/core.ts b/src/games/reversi/core.ts index 3ca9d052a..e724917fb 100644 --- a/src/games/reversi/core.ts +++ b/src/games/reversi/core.ts @@ -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); } };