Minor refactor
This commit is contained in:
parent
6bb62b9c87
commit
c04a4a40b0
|
@ -9,7 +9,7 @@ export class GameInstance {
|
|||
public readonly board: BoardCell[][];
|
||||
public currentPlayerColor: PlayerColor | null;
|
||||
public status: GameStatus;
|
||||
public winner: null | PlayerColor | 'draw';
|
||||
public winnerColor: null | PlayerColor | 'draw';
|
||||
public players: { black?: string; white?: string };
|
||||
|
||||
private readonly boardSize = 15;
|
||||
|
@ -22,7 +22,7 @@ export class GameInstance {
|
|||
);
|
||||
this.currentPlayerColor = null;
|
||||
this.status = 'waiting';
|
||||
this.winner = null;
|
||||
this.winnerColor = null;
|
||||
this.players = {};
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ export class GameInstance {
|
|||
|
||||
// Check for win condition
|
||||
if (this.checkWin(row, col, playerColor)) {
|
||||
this.winner = playerColor;
|
||||
this.winnerColor = playerColor;
|
||||
this.status = 'finished';
|
||||
this.currentPlayerColor = null;
|
||||
return { success: true };
|
||||
|
@ -113,7 +113,7 @@ export class GameInstance {
|
|||
|
||||
// Check for draw condition
|
||||
if (this.moveCount === this.boardSize * this.boardSize) {
|
||||
this.winner = 'draw';
|
||||
this.winnerColor = 'draw';
|
||||
this.status = 'finished';
|
||||
this.currentPlayerColor = null;
|
||||
return { success: true };
|
||||
|
|
Loading…
Reference in New Issue