mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-11-01 15:45:58 +09:00
Fix bug
This commit is contained in:
parent
3a9b0cce4a
commit
8281249806
@ -224,10 +224,15 @@ export default class Othello {
|
|||||||
|
|
||||||
// 座標が指し示す位置がボード外に出たとき
|
// 座標が指し示す位置がボード外に出たとき
|
||||||
if (this.opts.loopedBoard) {
|
if (this.opts.loopedBoard) {
|
||||||
if (x < 0 ) x = this.mapWidth - (-x);
|
if (x < 0 ) x = this.mapWidth - ((-x) % this.mapWidth);
|
||||||
if (y < 0 ) y = this.mapHeight - (-y);
|
if (y < 0 ) y = this.mapHeight - ((-y) % this.mapHeight);
|
||||||
if (x >= this.mapWidth ) x = x - this.mapWidth;
|
if (x >= this.mapWidth ) x = x % this.mapWidth;
|
||||||
if (y >= this.mapHeight) y = y - this.mapHeight;
|
if (y >= this.mapHeight) y = y % this.mapHeight;
|
||||||
|
|
||||||
|
// for debug
|
||||||
|
//if (x < 0 || y < 0 || x >= this.mapWidth || y >= this.mapHeight) {
|
||||||
|
// console.log(x, y);
|
||||||
|
//}
|
||||||
|
|
||||||
// 一周して自分に帰ってきたら
|
// 一周して自分に帰ってきたら
|
||||||
if (this.transformXyToPos(x, y) == initPos) break;
|
if (this.transformXyToPos(x, y) == initPos) break;
|
||||||
|
@ -815,3 +815,22 @@ export const test2: Map = {
|
|||||||
'-w--b-'
|
'-w--b-'
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const test3: Map = {
|
||||||
|
name: 'Test3',
|
||||||
|
category: 'Test',
|
||||||
|
data: [
|
||||||
|
'-w-',
|
||||||
|
'--w',
|
||||||
|
'w--',
|
||||||
|
'-w-',
|
||||||
|
'--w',
|
||||||
|
'w--',
|
||||||
|
'-w-',
|
||||||
|
'--w',
|
||||||
|
'w--',
|
||||||
|
'-w-',
|
||||||
|
'---',
|
||||||
|
'b--',
|
||||||
|
]
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user