Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game history rengo merge #1691

Merged
merged 9 commits into from
Feb 8, 2022
3 changes: 3 additions & 0 deletions src/lib/rank_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ export interface EffectiveOutcome {
white_effective_stronger: boolean;
}

/**
* @returns a ratings object containing ratings adjusted for the handicap.
*/
export function effective_outcome(
black_rating: number,
white_rating: number,
Expand Down
75 changes: 75 additions & 0 deletions src/models/games.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright (C) 2022 Ben Jones
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare namespace rest_api {
/**
* One element of `results` from `player/%player_id%/games`
*
* This is a work in progress. Trust these values at your own risk.
* */
interface Game {
related: {
detail: string; // route to full game info
};
players: {
black: import("../lib/player_cache").PlayerCacheEntry;
white: import("../lib/player_cache").PlayerCacheEntry;
};
id: number;
name: string;
creator: number;
mode: "game";
source: "play";
black: number;
white: number;
width: number;
height: number;
rules: import("../lib/types").RuleSet;
ranked: boolean;
handicap: number;
komi: string; // floating point number
time_control: import("../components/TimeControl").TimeControlTypes.TimeControlSystem;

// these don't appear to be populated with useful data
black_player_rank: number;
black_player_rating: string; // floating point number
white_player_rank: number;
white_player_rating: string; // floating point number

time_per_move: number;
time_control_parameters: string; // TimeControl
disable_analysis: boolean;
tournament: number | null;
tournament_round: number;
ladder: number;
pause_on_weekends: boolean;
outcome: `${number} points` | "Cancellation" | "Resignation";
black_lost: boolean;
white_lost: boolean;
annulled: boolean;
started: string; // ISODate
ended: string; // ISODate
sgf_filename: string | null;
// Guaranteed to include the player of interest (even in rengo games)
historical_ratings: {
black: import("../lib/player_cache").PlayerCacheEntry;
white: import("../lib/player_cache").PlayerCacheEntry;
};
rengo: boolean;
rengo_black_team?: number[];
rengo_white_team?: number[];
}
}