chess4js 1.0.0-beta.9a → 1.0.0-beta.9c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -462,20 +462,25 @@ are two types: arena and swiss instances. Both are further detailed in the examp
462
462
  | `activeMatches` | `ReadonlyArray<Match>` | Current matches being played. |
463
463
  | `finishedMatches` | `ReadonlyArray<Match>` | All concluded matches in the tournament history. |
464
464
  | `idGenerator` | `Nullable<() => string>` | Unique ID generator for assigning identifiers to match objects. |
465
+ | `id` | `Nullable<Any>` | The unique identifier for this tournament. |
466
+ | `name` | `Nullable<string>` | The display name of the tournament. |
467
+ | `timeControl` | `Nullable<string>` | The specific time settings for the matches (e.g., "3+2", "10 + 0"). |
468
+ | `type` | `Nullable<string>` | The category of the tournament based on the time control (e.g., "blitz", "bullet", "rapid"). |
465
469
 
466
470
  #### Methods
467
471
 
468
- | Method | Arguments | Return Type | Description |
469
- |----------------|--------------------|------------------------|----------------------------------------------------------------|
470
- | `addPlayer` | `player`: `Player` | None | Adds a player to the tournament. Player's name most be unique. |
471
- | `removePlayer` | `player`: `Player` | None | Removes a player from the tournament |
472
- | `nextRound` | None | `ReadonlyArray<Match>` | Generates a list of new pairings. |
472
+ | Method | Arguments | Return Type | Description |
473
+ |----------------|------------------------------------------------------------------------------------------------------------------------|------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
474
+ | `addPlayer` | `player`: `Player` | None | Adds a player to the tournament. Player's name most be unique. |
475
+ | `removePlayer` | `player`: `Player` | None | Removes a player from the tournament |
476
+ | `nextRound` | None | `ReadonlyArray<Match>` | Generates a list of new pairings. |
477
+ | `addMatch` | `white`: string, `black`: `Nullable<string>`, `outcome`: string, `id`: `Nullable<string>`, `round`: `Nullable<number>` | `boolean` | Adds a match to the tournament for the specified round. This method is ideal for cases where external logic is being used or an instance is being reconstructed. |
473
478
 
474
479
  #### Factories
475
480
 
476
- | Function | Arguments | Return Type | Description |
477
- |--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|-------------------------------------------------------------------------------|
478
- | `tournament` | `type`: `string`, `tiebreakers`: `Array<String>` default `["fidePerformance", "buchholz", "progressive", "sonnebornBerger"]`, `impactFactor`: `number` default `32`, `rangeFactor`: `number` default `400`, `logisticBase`: `number` default `10`, `idGenerator`: `Nullable<() => string>` default `null` | `Tournament` | Factory function to create a Tournament instance based on the specified type. |
481
+ | Function | Arguments | Return Type | Description |
482
+ |--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|-------------------------------------------------------------------------------|
483
+ | `tournament` | `type`: `string`, `tiebreakers`: `Array<String>` default `["fidePerformance", "buchholz", "progressive", "sonnebornBerger"]`, `impactFactor`: `number` default `32`, `rangeFactor`: `number` default `400`, `logisticBase`: `number` default `10`, `idGenerator`: `Nullable<() => string>` default `null`, `id`: `Nullable<any>` default `null`, `name`: `Nullable<string>` default `null`, `timeControl`: `Nullable<string>` default `null`, `timeControlType`: `Nullable<string>` default `null` | `Tournament` | Factory function to create a Tournament instance based on the specified type. |
479
484
 
480
485
  #### Examples
481
486
 
package/chess4js.d.mts CHANGED
@@ -392,12 +392,17 @@ export declare class Tournament {
392
392
  get leaderboard(): ReadonlyArray<Player>;
393
393
  get completed(): boolean;
394
394
  set completed(value: boolean);
395
+ get id(): Nullable<any>;
396
+ get name(): Nullable<string>;
397
+ get timeControl(): Nullable<string>;
398
+ get type(): Nullable<string>;
395
399
  get activeMatches(): ReadonlyArray<Match>;
396
400
  get finishedMatches(): ReadonlyArray<Match>;
397
401
  get idGenerator(): Nullable<() => string>;
398
402
  addPlayer(player: Player): void;
399
403
  removePlayer(player: Player): void;
400
404
  nextRound(): ReadonlyArray<Match>;
405
+ addMatch(white: string, black: Nullable<string>, outcome: string, id: Nullable<string>, round: Nullable<number>): boolean;
401
406
  }
402
407
  /** @deprecated $metadata$ is used for internal purposes, please don't use it in your code, because it can be removed at any moment */
403
408
  export declare namespace Tournament.$metadata$ {
@@ -438,5 +443,5 @@ export declare function parseGames(pgnInput: string, idSupplier?: () => Nullable
438
443
  export declare function scoreOf(score: string): Score;
439
444
  export declare function playerOf(name: string, initialElo: number): Player;
440
445
  export declare function matchOf(white: Player, black: Player, impactFactor?: number, rangeFactor?: number, logisticBase?: number, id?: Nullable<string>): Match;
441
- export declare function tournament(type: string, tiebreakers?: Array<string>, impactFactor?: number, rangeFactor?: number, logisticBase?: number, idGenerator?: Nullable<() => string>): Tournament;
446
+ export declare function tournament(type: string, tiebreakers?: Array<string>, impactFactor?: number, rangeFactor?: number, logisticBase?: number, idGenerator?: Nullable<() => string>, id?: Nullable<string>, name?: Nullable<string>, timeControl?: Nullable<string>, timeControlType?: Nullable<string>): Tournament;
442
447
  export declare function visibleSquares(piece: string, square: string, position: Position): Bitboard;