chess4js 1.0.0-beta.9a → 1.0.0-beta.9d
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 +18 -12
- package/chess4js.d.mts +8 -2
- package/chess4js.mjs +2167 -1988
- package/chess4js.mjs.map +1 -1
- package/kotlin-kotlin-stdlib.mjs +782 -776
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/package.json +1 -1
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>` |
|
|
427
|
+
| `id` | `Nullable<string>` | 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
|
|
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<string>` 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
|
|
|
@@ -462,20 +463,25 @@ are two types: arena and swiss instances. Both are further detailed in the examp
|
|
|
462
463
|
| `activeMatches` | `ReadonlyArray<Match>` | Current matches being played. |
|
|
463
464
|
| `finishedMatches` | `ReadonlyArray<Match>` | All concluded matches in the tournament history. |
|
|
464
465
|
| `idGenerator` | `Nullable<() => string>` | 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"). |
|
|
465
470
|
|
|
466
471
|
#### Methods
|
|
467
472
|
|
|
468
|
-
| Method | Arguments
|
|
469
|
-
|
|
470
|
-
| `addPlayer` | `player`: `Player`
|
|
471
|
-
| `removePlayer` | `player`: `Player`
|
|
472
|
-
| `nextRound` | None
|
|
473
|
+
| Method | Arguments | Return Type | Description |
|
|
474
|
+
|----------------|------------------------------------------------------------------------------------------------------------------------|------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
475
|
+
| `addPlayer` | `player`: `Player` | None | Adds a player to the tournament. Player's name most be unique. |
|
|
476
|
+
| `removePlayer` | `player`: `Player` | None | Removes a player from the tournament |
|
|
477
|
+
| `nextRound` | None | `ReadonlyArray<Match>` | Generates a list of new pairings. |
|
|
478
|
+
| `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
479
|
|
|
474
480
|
#### Factories
|
|
475
481
|
|
|
476
|
-
| Function | Arguments
|
|
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. |
|
|
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<() => 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
485
|
|
|
480
486
|
#### Examples
|
|
481
487
|
|
package/chess4js.d.mts
CHANGED
|
@@ -86,6 +86,7 @@ export declare class Match {
|
|
|
86
86
|
get outcome(): string;
|
|
87
87
|
set outcome(value: string);
|
|
88
88
|
get id(): Nullable<string>;
|
|
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 */
|
|
@@ -392,12 +393,17 @@ export declare class Tournament {
|
|
|
392
393
|
get leaderboard(): ReadonlyArray<Player>;
|
|
393
394
|
get completed(): boolean;
|
|
394
395
|
set completed(value: boolean);
|
|
396
|
+
get id(): Nullable<any>;
|
|
397
|
+
get name(): Nullable<string>;
|
|
398
|
+
get timeControl(): Nullable<string>;
|
|
399
|
+
get type(): Nullable<string>;
|
|
395
400
|
get activeMatches(): ReadonlyArray<Match>;
|
|
396
401
|
get finishedMatches(): ReadonlyArray<Match>;
|
|
397
402
|
get idGenerator(): Nullable<() => string>;
|
|
398
403
|
addPlayer(player: Player): void;
|
|
399
404
|
removePlayer(player: Player): void;
|
|
400
405
|
nextRound(): ReadonlyArray<Match>;
|
|
406
|
+
addMatch(white: string, black: Nullable<string>, outcome: string, id: Nullable<string>, round: Nullable<number>): boolean;
|
|
401
407
|
}
|
|
402
408
|
/** @deprecated $metadata$ is used for internal purposes, please don't use it in your code, because it can be removed at any moment */
|
|
403
409
|
export declare namespace Tournament.$metadata$ {
|
|
@@ -437,6 +443,6 @@ export declare function customGame(gameMode: string, threeRepetitionsMode: strin
|
|
|
437
443
|
export declare function parseGames(pgnInput: string, idSupplier?: () => Nullable<any>): ReadonlyArray<Game>;
|
|
438
444
|
export declare function scoreOf(score: string): Score;
|
|
439
445
|
export declare function playerOf(name: string, initialElo: number): Player;
|
|
440
|
-
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 matchOf(white: Player, black: Player, impactFactor?: number, rangeFactor?: number, logisticBase?: number, id?: Nullable<string>, round?: Nullable<number>): Match;
|
|
447
|
+
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
448
|
export declare function visibleSquares(piece: string, square: string, position: Position): Bitboard;
|