Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
simlmx committed Aug 18, 2024
1 parent d76cbd6 commit 7452323
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions packages/game/src/gameDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,20 +373,7 @@ export type Game<
GS extends GameStateBase = GameStateBase,
PMT extends MoveTypesBase = any,
BMT extends MoveTypesBase = any,
// PMT extends MoveTypesBase = MoveTypesBase,
// BMT extends MoveTypesBase = MoveTypesBase,
// PM = any,
// BM = any,
// PM extends Record<string, PlayerMove<GS, any, PMT, BMT>> = Record<
// string,
// PlayerMove<GS, any, PMT, BMT>
// >,
// BM extends Record<string, BoardMove<GS, any, PMT, BMT>> = Record<
// string,
// BoardMove<GS, any, PMT, BMT>
// >,
> = {
// version: string;
initialBoards: InitialBoard<GS>;
// There is a separate function for the `playerboard` for games that support adding a
// player into an ongoing match.
Expand All @@ -399,11 +386,6 @@ export type Game<
gameSettings?: GameSettings;
gamePlayerSettings?: GamePlayerSettings;

// Do we have `score`s for this game? This means for instance that we can show
// a leaderboard.

// mainScoreStat ?:

// Games can customize the match score representation using this hook.
getMatchScoreText?: (options: GetMatchScoreTextOptions<GS["B"]>) => string;

Expand All @@ -428,10 +410,6 @@ export type Game<

playerStats?: GameStats;
matchStats?: GameStats;

// Should we end a player's turn when they make a move?
// Defaults to `true`.
// playerMoveEndsTurn?: boolean;
};

/*
Expand All @@ -443,13 +421,9 @@ export type Game_<
GS extends GameStateBase = GameStateBase,
PMT extends MoveTypesBase = MoveTypesBase,
BMT extends MoveTypesBase = MoveTypesBase,
> = Omit<
Game<GS, PMT, BMT>,
"playerStats" | "matchStats" // | "playerMoveEndsTurn"
> & {
> = Omit<Game<GS, PMT, BMT>, "playerStats" | "matchStats"> & {
playerStats?: GameStats_;
matchStats?: GameStats_;
// playerMoveEndsTurn: boolean;
};

function normalizeArray<T extends Record<string, any>, K extends keyof T>(
Expand Down Expand Up @@ -504,10 +478,7 @@ export function parseGame<
const playerStats = normalizeStats(game.playerStats);
const matchStats = normalizeStats(game.matchStats);

// Add the default value.
// const { playerMoveEndsTurn = true } = game;

return { ...game, playerStats, matchStats }; //, playerMoveEndsTurn };
return { ...game, playerStats, matchStats };
}

// Game Manifest
Expand Down

0 comments on commit 7452323

Please sign in to comment.