summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2024-01-20 09:59:04 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2024-01-20 09:59:04 +0900
commite2985cf122b54c31c2b7b33188497c5e907e6dad (patch)
treece9835fc4188c2ec7077760896313a086dcc77c1 /packages
parentlint fix (diff)
downloadmisskey-e2985cf122b54c31c2b7b33188497c5e907e6dad.tar.gz
misskey-e2985cf122b54c31c2b7b33188497c5e907e6dad.tar.bz2
misskey-e2985cf122b54c31c2b7b33188497c5e907e6dad.zip
lint fixes
Diffstat (limited to 'packages')
-rw-r--r--packages/misskey-reversi/src/game.ts26
-rw-r--r--packages/misskey-reversi/src/maps.ts166
2 files changed, 95 insertions, 97 deletions
diff --git a/packages/misskey-reversi/src/game.ts b/packages/misskey-reversi/src/game.ts
index 55d0b84da7..72aace7c0b 100644
--- a/packages/misskey-reversi/src/game.ts
+++ b/packages/misskey-reversi/src/game.ts
@@ -67,8 +67,7 @@ export class Game {
//#endregion
// ゲームが始まった時点で片方の色の石しかないか、始まった時点で勝敗が決定するようなマップの場合がある
- if (!this.canPutSomewhere(BLACK))
- this.turn = this.canPutSomewhere(WHITE) ? WHITE : null;
+ if (!this.canPutSomewhere(BLACK)) this.turn = this.canPutSomewhere(WHITE) ? WHITE : null;
}
public get blackCount() {
@@ -109,7 +108,7 @@ export class Game {
color,
pos,
effects,
- turn
+ turn,
});
this.calcTurn();
@@ -151,7 +150,7 @@ export class Game {
public canPut(color: Color, pos: number): boolean {
return (
this.board[pos] !== null ? false : // 既に石が置いてある場所には打てない
- this.opts.canPutEverywhere ? this.mapDataGet(pos) == 'empty' : // 挟んでなくても置けるモード
+ this.opts.canPutEverywhere ? this.mapDataGet(pos) === 'empty' : // 挟んでなくても置けるモード
this.effects(color, pos).length !== 0); // 相手の石を1つでも反転させられるか
}
@@ -164,14 +163,14 @@ export class Game {
const enemyColor = !color;
const diffVectors: [number, number][] = [
- [ 0, -1], // 上
+ [0, -1], // 上
[+1, -1], // 右上
- [+1, 0], // 右
+ [+1, 0], // 右
[+1, +1], // 右下
- [ 0, +1], // 下
+ [0, +1], // 下
[-1, +1], // 左下
- [-1, 0], // 左
- [-1, -1] // 左上
+ [-1, 0], // 左
+ [-1, -1], // 左上
];
const effectsInLine = ([dx, dy]: [number, number]): number[] => {
@@ -185,11 +184,10 @@ export class Game {
// 座標が指し示す位置がボード外に出たとき
if (this.opts.loopedBoard && this.xyToPos(
(x = ((x % this.mapWidth) + this.mapWidth) % this.mapWidth),
- (y = ((y % this.mapHeight) + this.mapHeight) % this.mapHeight)) === initPos)
- // 盤面の境界でループし、自分が石を置く位置に戻ってきたとき、挟めるようにしている (ref: Test4のマップ)
+ (y = ((y % this.mapHeight) + this.mapHeight) % this.mapHeight)) === initPos) {
+ // 盤面の境界でループし、自分が石を置く位置に戻ってきたとき、挟めるようにしている (ref: Test4のマップ)
return found;
- else if (x === -1 || y === -1 || x === this.mapWidth || y === this.mapHeight)
- return []; // 挟めないことが確定 (盤面外に到達)
+ } else if (x === -1 || y === -1 || x === this.mapWidth || y === this.mapHeight) return []; // 挟めないことが確定 (盤面外に到達)
const pos = this.xyToPos(x, y);
if (this.mapDataGet(pos) === 'null') return []; // 挟めないことが確定 (配置不可能なマスに到達)
@@ -209,7 +207,7 @@ export class Game {
public get winner(): Color | null {
return this.isEnded ?
- this.blackCount == this.whiteCount ? null :
+ this.blackCount === this.whiteCount ? null :
this.opts.isLlotheo === this.blackCount > this.whiteCount ? WHITE : BLACK :
undefined as never;
}
diff --git a/packages/misskey-reversi/src/maps.ts b/packages/misskey-reversi/src/maps.ts
index b47a996c7c..c0fbae16ba 100644
--- a/packages/misskey-reversi/src/maps.ts
+++ b/packages/misskey-reversi/src/maps.ts
@@ -27,8 +27,8 @@ export const fourfour: Map = {
'----',
'-wb-',
'-bw-',
- '----'
- ]
+ '----',
+ ],
};
export const sixsix: Map = {
@@ -40,8 +40,8 @@ export const sixsix: Map = {
'--wb--',
'--bw--',
'------',
- '------'
- ]
+ '------',
+ ],
};
export const roundedSixsix: Map = {
@@ -54,8 +54,8 @@ export const roundedSixsix: Map = {
'--wb--',
'--bw--',
'------',
- ' ---- '
- ]
+ ' ---- ',
+ ],
};
export const roundedSixsix2: Map = {
@@ -68,8 +68,8 @@ export const roundedSixsix2: Map = {
'--wb--',
'--bw--',
' ---- ',
- ' -- '
- ]
+ ' -- ',
+ ],
};
export const eighteight: Map = {
@@ -83,8 +83,8 @@ export const eighteight: Map = {
'---bw---',
'--------',
'--------',
- '--------'
- ]
+ '--------',
+ ],
};
export const eighteightH28: Map = {
@@ -98,8 +98,8 @@ export const eighteightH28: Map = {
'b--bw--b',
'b------b',
'b------b',
- 'bbbbbbbb'
- ]
+ 'bbbbbbbb',
+ ],
};
export const roundedEighteight: Map = {
@@ -114,8 +114,8 @@ export const roundedEighteight: Map = {
'---bw---',
'--------',
'--------',
- ' ------ '
- ]
+ ' ------ ',
+ ],
};
export const roundedEighteight2: Map = {
@@ -130,8 +130,8 @@ export const roundedEighteight2: Map = {
'---bw---',
'--------',
' ------ ',
- ' ---- '
- ]
+ ' ---- ',
+ ],
};
export const roundedEighteight3: Map = {
@@ -146,8 +146,8 @@ export const roundedEighteight3: Map = {
'---bw---',
' ------ ',
' ---- ',
- ' -- '
- ]
+ ' -- ',
+ ],
};
export const eighteightWithNotch: Map = {
@@ -162,8 +162,8 @@ export const eighteightWithNotch: Map = {
' --bw-- ',
'--------',
'--------',
- '--- ---'
- ]
+ '--- ---',
+ ],
};
export const eighteightWithSomeHoles: Map = {
@@ -178,8 +178,8 @@ export const eighteightWithSomeHoles: Map = {
'---bw- -',
' -------',
'--- ----',
- '--------'
- ]
+ '--------',
+ ],
};
export const circle: Map = {
@@ -194,8 +194,8 @@ export const circle: Map = {
'---bw---',
' ------ ',
' ------ ',
- ' -- '
- ]
+ ' -- ',
+ ],
};
export const smile: Map = {
@@ -210,8 +210,8 @@ export const smile: Map = {
'-- bw --',
'--- ---',
'--------',
- ' ------ '
- ]
+ ' ------ ',
+ ],
};
export const window: Map = {
@@ -226,8 +226,8 @@ export const window: Map = {
'---bw---',
'- -- -',
'- -- -',
- '--------'
- ]
+ '--------',
+ ],
};
export const reserved: Map = {
@@ -242,8 +242,8 @@ export const reserved: Map = {
'---bw---',
'--------',
'--------',
- 'b------w'
- ]
+ 'b------w',
+ ],
};
export const x: Map = {
@@ -258,8 +258,8 @@ export const x: Map = {
'---bw---',
'--b--w--',
'-b----w-',
- 'b------w'
- ]
+ 'b------w',
+ ],
};
export const parallel: Map = {
@@ -274,8 +274,8 @@ export const parallel: Map = {
'---ww---',
'--------',
'--------',
- '--------'
- ]
+ '--------',
+ ],
};
export const lackOfBlack: Map = {
@@ -289,8 +289,8 @@ export const lackOfBlack: Map = {
'---bw---',
'--------',
'--------',
- '--------'
- ]
+ '--------',
+ ],
};
export const squareParty: Map = {
@@ -305,8 +305,8 @@ export const squareParty: Map = {
'-bbbwww-',
'-b-bw-w-',
'-bbbwww-',
- '--------'
- ]
+ '--------',
+ ],
};
export const minesweeper: Map = {
@@ -321,8 +321,8 @@ export const minesweeper: Map = {
'-w-bw-b-',
'b-w--b-w',
'-b-bw-w-',
- 'w-w--b-b'
- ]
+ 'w-w--b-b',
+ ],
};
export const tenthtenth: Map = {
@@ -338,8 +338,8 @@ export const tenthtenth: Map = {
'----------',
'----------',
'----------',
- '----------'
- ]
+ '----------',
+ ],
};
export const hole: Map = {
@@ -356,8 +356,8 @@ export const hole: Map = {
'--wb--wb--',
'--bw--bw--',
'----------',
- '----------'
- ]
+ '----------',
+ ],
};
export const grid: Map = {
@@ -374,8 +374,8 @@ export const grid: Map = {
'- - -- - -',
'----------',
'- - -- - -',
- '----------'
- ]
+ '----------',
+ ],
};
export const cross: Map = {
@@ -392,8 +392,8 @@ export const cross: Map = {
'----------',
' ---- ',
' ---- ',
- ' ---- '
- ]
+ ' ---- ',
+ ],
};
export const charX: Map = {
@@ -410,8 +410,8 @@ export const charX: Map = {
' -------- ',
'----------',
'---- ----',
- '--- ---'
- ]
+ '--- ---',
+ ],
};
export const charY: Map = {
@@ -428,8 +428,8 @@ export const charY: Map = {
' ------ ',
' ------ ',
' ------ ',
- ' ------ '
- ]
+ ' ------ ',
+ ],
};
export const walls: Map = {
@@ -446,8 +446,8 @@ export const walls: Map = {
'w--------w',
'w--------w',
'w--------w',
- ' bbbbbbbb '
- ]
+ ' bbbbbbbb ',
+ ],
};
export const cpu: Map = {
@@ -464,8 +464,8 @@ export const cpu: Map = {
'w--------w',
' -------- ',
'w--------w',
- ' b b b b '
- ]
+ ' b b b b ',
+ ],
};
export const checker: Map = {
@@ -482,8 +482,8 @@ export const checker: Map = {
'---bwbw---',
'----------',
'----------',
- '----------'
- ]
+ '----------',
+ ],
};
export const japaneseCurry: Map = {
@@ -500,8 +500,8 @@ export const japaneseCurry: Map = {
'w-w-w-b-b-',
'-w-w-w-b-b',
'w-w-w-w-b-',
- '-w-w-w-w-b'
- ]
+ '-w-w-w-w-b',
+ ],
};
export const mosaic: Map = {
@@ -519,7 +519,7 @@ export const mosaic: Map = {
' - - - - -',
'- - - - - ',
' - - - - -',
- ]
+ ],
};
export const arena: Map = {
@@ -536,8 +536,8 @@ export const arena: Map = {
' -------- ',
'- ------ -',
' - - - - ',
- '- - -- - -'
- ]
+ '- - -- - -',
+ ],
};
export const reactor: Map = {
@@ -554,8 +554,8 @@ export const reactor: Map = {
'---w b---',
'- --bw-- -',
'w- - - -b',
- '-b------w-'
- ]
+ '-b------w-',
+ ],
};
export const sixeight: Map = {
@@ -569,8 +569,8 @@ export const sixeight: Map = {
'--bw--',
'------',
'------',
- '------'
- ]
+ '------',
+ ],
};
export const spark: Map = {
@@ -587,8 +587,8 @@ export const spark: Map = {
' -------- ',
' -------- ',
'----------',
- ' - - '
- ]
+ ' - - ',
+ ],
};
export const islands: Map = {
@@ -605,8 +605,8 @@ export const islands: Map = {
' --------',
' --------',
' --------',
- ' --------'
- ]
+ ' --------',
+ ],
};
export const galaxy: Map = {
@@ -625,8 +625,8 @@ export const galaxy: Map = {
'---w--bbb---',
' ---w------ ',
' ---www-- ',
- ' ------ '
- ]
+ ' ------ ',
+ ],
};
export const triangle: Map = {
@@ -643,8 +643,8 @@ export const triangle: Map = {
' -------- ',
' -------- ',
'----------',
- '----------'
- ]
+ '----------',
+ ],
};
export const iphonex: Map = {
@@ -663,8 +663,8 @@ export const iphonex: Map = {
'--------',
'--------',
'--------',
- ' ------ '
- ]
+ ' ------ ',
+ ],
};
export const dealWithIt: Map = {
@@ -676,8 +676,8 @@ export const dealWithIt: Map = {
'--w-b-------',
' --b-w------',
' --w-b---- ',
- ' ------- '
- ]
+ ' ------- ',
+ ],
};
export const bigBoard: Map = {
@@ -699,8 +699,8 @@ export const bigBoard: Map = {
'----------------',
'----------------',
'----------------',
- '----------------'
- ]
+ '----------------',
+ ],
};
export const twoBoard: Map = {
@@ -715,6 +715,6 @@ export const twoBoard: Map = {
'---bw--- ---bw---',
'-------- --------',
'-------- --------',
- '-------- --------'
- ]
+ '-------- --------',
+ ],
};