Minor refactor

This commit is contained in:
sepia 2025-07-20 19:51:41 -05:00
parent 6bb62b9c87
commit c04a4a40b0
1 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ export class GameInstance {
public readonly board: BoardCell[][]; public readonly board: BoardCell[][];
public currentPlayerColor: PlayerColor | null; public currentPlayerColor: PlayerColor | null;
public status: GameStatus; public status: GameStatus;
public winner: null | PlayerColor | 'draw'; public winnerColor: null | PlayerColor | 'draw';
public players: { black?: string; white?: string }; public players: { black?: string; white?: string };
private readonly boardSize = 15; private readonly boardSize = 15;
@ -22,7 +22,7 @@ export class GameInstance {
); );
this.currentPlayerColor = null; this.currentPlayerColor = null;
this.status = 'waiting'; this.status = 'waiting';
this.winner = null; this.winnerColor = null;
this.players = {}; this.players = {};
} }
@ -105,7 +105,7 @@ export class GameInstance {
// Check for win condition // Check for win condition
if (this.checkWin(row, col, playerColor)) { if (this.checkWin(row, col, playerColor)) {
this.winner = playerColor; this.winnerColor = playerColor;
this.status = 'finished'; this.status = 'finished';
this.currentPlayerColor = null; this.currentPlayerColor = null;
return { success: true }; return { success: true };
@ -113,7 +113,7 @@ export class GameInstance {
// Check for draw condition // Check for draw condition
if (this.moveCount === this.boardSize * this.boardSize) { if (this.moveCount === this.boardSize * this.boardSize) {
this.winner = 'draw'; this.winnerColor = 'draw';
this.status = 'finished'; this.status = 'finished';
this.currentPlayerColor = null; this.currentPlayerColor = null;
return { success: true }; return { success: true };