Add resign button

This commit is contained in:
sepia 2025-07-21 22:54:03 -05:00
parent 10a4bd64d2
commit 3093754bd4
6 changed files with 79 additions and 28 deletions

View file

@ -76,6 +76,12 @@ export class GomokuGame {
return { success: true };
}
public resign(resigningPlayerColor: PlayerColor) {
this.winnerColor = resigningPlayerColor === 'white' ? 'black' : 'white';
this.status = 'finished';
this.currentPlayerColor = null;
}
private checkWin(row: number, col: number, color: PlayerColor): boolean {
const directions = [
[1, 0], // vertical