Skip to content

Commit

Permalink
Add is_game_record flag for games
Browse files Browse the repository at this point in the history
  • Loading branch information
anoek committed Jul 27, 2024
1 parent 8d60a29 commit 3bd44e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/GobanBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,9 @@ export abstract class GobanBase extends EventEmitter<GobanEvents> {
public decodePrettyCoordinates(coordinates: string): JGOFMove {
return this.engine.decodePrettyCoordinates(coordinates);
}

/** True if the game is a game record of a real life game */
public get is_game_record(): boolean {
return this.engine.is_game_record;
}
}
3 changes: 3 additions & 0 deletions src/engine/GobanEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export interface GobanEngineConfig extends BoardConfig {
reviews?: {
[review_id: number]: GobanEnginePlayerEntry;
};
is_game_record?: boolean /* Indicates that this game is a game record of a real life game */;

time_control?: JGOFTimeControl;
moves?: GobanMovesArray;
Expand Down Expand Up @@ -342,6 +343,7 @@ export class GobanEngine extends BoardState {
};
public rengo_casual_mode: boolean;
public stalling_score_estimate?: StallingScoreEstimate;
public readonly is_game_record: boolean = false;

/* Properties that emit change events */
private _phase: GobanEnginePhase = "play";
Expand Down Expand Up @@ -507,6 +509,7 @@ export class GobanEngine extends BoardState {

const self = this;
this.config = config;
this.is_game_record = !!config.is_game_record;
this.dontStoreBoardHistory =
!!dontStoreBoardHistory; /* Server side, we don't want to store board snapshots */

Expand Down

0 comments on commit 3bd44e5

Please sign in to comment.