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

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
@@ -424,13 +424,14 @@ factory.
424
424
  | `white` | `Nullable<Player>` | The white player. |
425
425
  | `black` | `Nullable<Player>` | The black player. |
426
426
  | `outcome` | `string` | The outcome of the match, can be "1-0", "0-1", "1/2-1/2", "in game" or "suspended" |
427
- | `id` | `Nullable<string>` | An id for the match |
427
+ | `id` | `Nullable<any>` | A unique id for the match |
428
+ | `round` | `Nullable<number>` | The round number (0-based) for the match or null if not applicable |
428
429
 
429
430
  #### Factories
430
431
 
431
- | Function | Arguments | Return type | Description |
432
- |-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|-------------------------------------------------------------------------------------------------------|
433
- | `matchOf` | `white`: `Player`, `black`: `Player`, `impactFactor`: `number` default `32`, `rangeFactor`: `number` default `400`, `logisticBase`: `number` default `10` | `Match` | Creates a match between two players with the given elo calculation parameters or with default values. |
432
+ | Function | Arguments | Return type | Description |
433
+ |-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|-------------------------------------------------------------------------------------------------------|
434
+ | `matchOf` | `white`: `Player`, `black`: `Player`, `impactFactor`: `number` default `32`, `rangeFactor`: `number` default `400`, `logisticBase`: `number` default `10`, `id`: `Nullable<any>` default `null`, `round`: `Nullable<number>` default `null` | `Match` | Creates a match between two players with the given elo calculation parameters or with default values. |
434
435
 
435
436
  #### Example
436
437
 
@@ -451,21 +452,21 @@ are two types: arena and swiss instances. Both are further detailed in the examp
451
452
 
452
453
  #### Properties
453
454
 
454
- | Property | Type | Description |
455
- |-------------------|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
456
- | `impactFactor` | `number` | The K-factor that determines how much a single match affects the rating. A higher value leads to faster rating changes. Default is 32.0. |
457
- | `rangeFactor` | `number` | The scale factor used to determine win probability. Default is 400.0. |
458
- | `logisticBase` | `number` | The base of the exponent in the logistic function. Default is 10. |
459
- | `tiebreakers` | `Array<string>` | The strategy for breaking ties in the leaderboard. |
460
- | `leaderboard` | `ReadonlyArray<Player>` | Current player standings, ordered by score and tie-breakers. |
461
- | `completed` | `boolean` | Whether the tournament has reached its conclusion. |
462
- | `activeMatches` | `ReadonlyArray<Match>` | Current matches being played. |
463
- | `finishedMatches` | `ReadonlyArray<Match>` | All concluded matches in the tournament history. |
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"). |
455
+ | Property | Type | Description |
456
+ |-------------------|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
457
+ | `impactFactor` | `number` | The K-factor that determines how much a single match affects the rating. A higher value leads to faster rating changes. Default is 32.0. |
458
+ | `rangeFactor` | `number` | The scale factor used to determine win probability. Default is 400.0. |
459
+ | `logisticBase` | `number` | The base of the exponent in the logistic function. Default is 10. |
460
+ | `tiebreakers` | `Array<string>` | The strategy for breaking ties in the leaderboard. |
461
+ | `leaderboard` | `ReadonlyArray<Player>` | Current player standings, ordered by score and tie-breakers. |
462
+ | `completed` | `boolean` | Whether the tournament has reached its conclusion. |
463
+ | `activeMatches` | `ReadonlyArray<Match>` | Current matches being played. |
464
+ | `finishedMatches` | `ReadonlyArray<Match>` | All concluded matches in the tournament history. |
465
+ | `idGenerator` | `Nullable<() => any>` | Unique ID generator for assigning identifiers to match objects. |
466
+ | `id` | `Nullable<Any>` | The unique identifier for this tournament. |
467
+ | `name` | `Nullable<string>` | The display name of the tournament. |
468
+ | `timeControl` | `Nullable<string>` | The specific time settings for the matches (e.g., "3+2", "10 + 0"). |
469
+ | `type` | `Nullable<string>` | The category of the tournament based on the time control (e.g., "blitz", "bullet", "rapid"). |
469
470
 
470
471
  #### Methods
471
472
 
@@ -478,9 +479,9 @@ are two types: arena and swiss instances. Both are further detailed in the examp
478
479
 
479
480
  #### Factories
480
481
 
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. |
482
+ | Function | Arguments | Return Type | Description |
483
+ |--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|-------------------------------------------------------------------------------|
484
+ | `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<() => any>` 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. |
484
485
 
485
486
  #### Examples
486
487
 
package/chess4js.d.mts CHANGED
@@ -85,7 +85,8 @@ export declare class Match {
85
85
  get black(): Nullable<Player>;
86
86
  get outcome(): string;
87
87
  set outcome(value: string);
88
- get id(): Nullable<string>;
88
+ get id(): Nullable<any>;
89
+ get round(): Nullable<number>;
89
90
  toString(): string;
90
91
  }
91
92
  /** @deprecated $metadata$ is used for internal purposes, please don't use it in your code, because it can be removed at any moment */
@@ -398,7 +399,7 @@ export declare class Tournament {
398
399
  get type(): Nullable<string>;
399
400
  get activeMatches(): ReadonlyArray<Match>;
400
401
  get finishedMatches(): ReadonlyArray<Match>;
401
- get idGenerator(): Nullable<() => string>;
402
+ get idGenerator(): Nullable<() => any>;
402
403
  addPlayer(player: Player): void;
403
404
  removePlayer(player: Player): void;
404
405
  nextRound(): ReadonlyArray<Match>;
@@ -442,6 +443,6 @@ export declare function customGame(gameMode: string, threeRepetitionsMode: strin
442
443
  export declare function parseGames(pgnInput: string, idSupplier?: () => Nullable<any>): ReadonlyArray<Game>;
443
444
  export declare function scoreOf(score: string): Score;
444
445
  export declare function playerOf(name: string, initialElo: number): Player;
445
- export declare function matchOf(white: Player, black: Player, impactFactor?: number, rangeFactor?: number, logisticBase?: number, id?: Nullable<string>): Match;
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;
446
+ export declare function matchOf(white: Player, black: Player, impactFactor?: number, rangeFactor?: number, logisticBase?: number, id?: Nullable<any>, round?: Nullable<number>): Match;
447
+ export declare function tournament(type: string, tiebreakers?: Array<string>, impactFactor?: number, rangeFactor?: number, logisticBase?: number, idGenerator?: Nullable<() => any>, id?: Nullable<string>, name?: Nullable<string>, timeControl?: Nullable<string>, timeControlType?: Nullable<string>): Tournament;
447
448
  export declare function visibleSquares(piece: string, square: string, position: Position): Bitboard;