flow
This commit is contained in:
@ -69,15 +69,18 @@ export class MatchSession {
|
||||
let gameNumber: number = 0;
|
||||
this.matchInProgress = true
|
||||
this.playerNotificationManager.notifyMatchState(this);
|
||||
let winnerIndex: number | null = null;
|
||||
while (this.matchInProgress) {
|
||||
|
||||
this.currentGame = new DominoesGame(this.players, this.rng);
|
||||
if (winnerIndex !== null) {
|
||||
this.currentGame.setForcedInitialPlayerIndex(winnerIndex);
|
||||
}
|
||||
gameNumber += 1;
|
||||
this.state = 'started'
|
||||
this.logger.info(`Game #${gameNumber} started`);
|
||||
// this.game.reset()
|
||||
const gameSummary = await this.currentGame.start();
|
||||
this.logger.debug('gameSummary :>> ', gameSummary);
|
||||
winnerIndex = this.players.findIndex(player => player.id === gameSummary.winner?.id);
|
||||
this.setScores();
|
||||
this.checkMatchWinner();
|
||||
this.resetPlayers();
|
||||
|
Reference in New Issue
Block a user