@konoui/mjimage 0.8.0 → 0.10.0

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/dist/index.d.cts CHANGED
@@ -17,6 +17,19 @@ import { StateValue } from 'xstate';
17
17
  import { StrictObjectSchema } from 'valibot';
18
18
  import { StringSchema } from 'valibot';
19
19
 
20
+ export declare class ActionLogic {
21
+ static doWin(hand: Hand, env: BoardContext, t: Tile, riverDiscarded: readonly {
22
+ t: Tile;
23
+ }[]): false | WinResult;
24
+ static doChi(hand: Hand, iam: Wind, discardedBy: Wind, t: Tile): false | readonly BlockChi[];
25
+ static doPon(hand: Hand, iam: Wind, discardedBy: Wind, t: Tile): false | readonly BlockPon[];
26
+ static doReach(hand: Hand): false | readonly TileAnalysis[];
27
+ static doDiscard(hand: Hand, called?: BlockChi | BlockPon): readonly Tile[];
28
+ static doDaiKan(hand: Hand, iam: Wind, discardedBy: Wind, t: Tile): false | BlockDaiKan;
29
+ static doAnkan(hand: Hand): false | BlockAnKan[];
30
+ static doShoKan(hand: Hand): false | BlockShoKan[];
31
+ }
32
+
20
33
  export declare class ActorHand extends Hand {
21
34
  isBackHand(): boolean;
22
35
  clone(): ActorHand;
@@ -36,16 +49,12 @@ export declare abstract class BaseActor {
36
49
  river: IRiver;
37
50
  placeManager: PlaceManager;
38
51
  scoreManager: ScoreManager;
39
- hands: {
40
- "1z": ActorHand;
41
- "2z": ActorHand;
42
- "3z": ActorHand;
43
- "4z": ActorHand;
44
- };
52
+ hands: WindMap<ActorHand>;
45
53
  counter: Counter;
46
- doraIndicators: Tile[];
54
+ private _doraIndicators;
47
55
  eventHandler: EventHandler;
48
56
  constructor(id: string, eventHandler: EventHandler);
57
+ get doraIndicators(): readonly Tile[];
49
58
  hand(w: Wind): ActorHand;
50
59
  protected abstract setHands(e: DistributeEvent): void;
51
60
  handleEvent(e: PlayerEvent): void;
@@ -90,8 +99,8 @@ export declare abstract class Block {
90
99
  private readonly _tiles;
91
100
  private readonly _type;
92
101
  constructor(tiles: readonly Tile[], type: BlockType);
93
- static from(tiles: string): BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair;
94
- static deserialize(v: SerializedBlock): Block | BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair;
102
+ static from(tiles: string): Block;
103
+ static deserialize(v: SerializedBlock): Block | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockPair | BlockRun | BlockThree | BlockHand | BlockIsolated | BlockOther;
95
104
  serialize(): {
96
105
  tiles: string;
97
106
  type: BlockType;
@@ -110,7 +119,7 @@ export declare abstract class Block {
110
119
  idx: number;
111
120
  tile: Tile;
112
121
  };
113
- }): Block | BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair;
122
+ }): Block | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockPair | BlockRun | BlockThree | BlockHand | BlockIsolated | BlockOther;
114
123
  }
115
124
 
116
125
  export declare class BlockAnKan extends Block {
@@ -124,13 +133,13 @@ export declare class BlockAnKan extends Block {
124
133
  export declare class BlockCalculator {
125
134
  hand: Hand;
126
135
  constructor(hand: Hand);
127
- calc(lastTile: Tile): readonly Block[][];
128
- markedHands(hands: readonly Block[][], lastTile: Tile): readonly Block[][];
129
- markedHand(hand: readonly Block[], lastTile: Tile): readonly Block[][];
130
- sevenPairs(): readonly Block[][];
131
- thirteenOrphans(): readonly Block[][];
132
- nineGates(): readonly Block[][];
133
- standardType(): readonly Block[][];
136
+ calc(lastTile: Tile): readonly (readonly Block[])[];
137
+ markedHands(hands: readonly (readonly Block[])[], lastTile: Tile): readonly (readonly Block[])[];
138
+ markedHand(hand: readonly Block[], lastTile: Tile): readonly (readonly Block[])[];
139
+ sevenPairs(): readonly (readonly Block[])[];
140
+ thirteenOrphans(): readonly (readonly Block[])[];
141
+ nineGates(): readonly (readonly Block[])[];
142
+ standardType(): readonly (readonly Block[])[];
134
143
  private calcAllBlockCombinations;
135
144
  private handleBack;
136
145
  private handleZ;
@@ -211,7 +220,7 @@ export declare interface BoardContext {
211
220
  readonly reach: number;
212
221
  readonly dead: number;
213
222
  };
214
- reached?: 1 | 2;
223
+ doubleReached?: boolean;
215
224
  replacementWin?: boolean;
216
225
  quadWin?: boolean;
217
226
  finalWallWin?: boolean;
@@ -238,7 +247,7 @@ export declare interface ChoiceAfterCalled {
238
247
  id: string;
239
248
  type: Extract<Event_2, "CHOICE_AFTER_CALLED">;
240
249
  wind: Wind;
241
- choices: Pick<DrawnChoice, "DISCARD">;
250
+ choices: Pick<DrawChoice, "DISCARD">;
242
251
  }
243
252
 
244
253
  export declare interface ChoiceAfterDiscardedEvent {
@@ -246,10 +255,10 @@ export declare interface ChoiceAfterDiscardedEvent {
246
255
  type: Extract<Event_2, "CHOICE_AFTER_DISCARDED">;
247
256
  wind: Wind;
248
257
  discarterInfo: {
249
- wind: Wind;
250
- tile: string;
258
+ readonly wind: Wind;
259
+ readonly tile: string;
251
260
  };
252
- choices: DiscardedChoice;
261
+ choices: DiscardChoice;
253
262
  }
254
263
 
255
264
  export declare interface ChoiceAfterDrawnEvent {
@@ -257,23 +266,23 @@ export declare interface ChoiceAfterDrawnEvent {
257
266
  type: Extract<Event_2, "CHOICE_AFTER_DRAWN">;
258
267
  wind: Wind;
259
268
  drawerInfo: {
260
- wind: Wind;
261
- tile: string;
269
+ readonly wind: Wind;
270
+ readonly tile: string;
262
271
  };
263
- choices: DrawnChoice;
272
+ choices: DrawChoice;
264
273
  }
265
274
 
266
- declare type ChoiceEvent = "PON" | "CHI" | "RON" | "DISCARD" | "TSUMO" | "REACH" | "AN_KAN" | "SHO_KAN" | "DAI_KAN" | "DRAWN_GAME_BY_NINE_ORPHANS";
275
+ declare type ChoiceEvent = "PON" | "CHI" | "RON" | "DISCARD" | "TSUMO" | "REACH" | "AN_KAN" | "SHO_KAN" | "DAI_KAN" | "DRAWN_GAME_BY_NINE_TERMINALS";
267
276
 
268
277
  export declare interface ChoiceForChanKan {
269
278
  id: string;
270
279
  type: Extract<Event_2, "CHOICE_FOR_CHAN_KAN">;
271
280
  wind: Wind;
272
281
  callerInfo: {
273
- wind: Wind;
274
- tile: string;
282
+ readonly wind: Wind;
283
+ readonly tile: string;
275
284
  };
276
- choices: Pick<DiscardedChoice, "RON">;
285
+ choices: Pick<DiscardChoice, "RON">;
277
286
  }
278
287
 
279
288
  export declare interface ChoiceForReachAcceptance {
@@ -281,12 +290,14 @@ export declare interface ChoiceForReachAcceptance {
281
290
  type: Extract<Event_2, "CHOICE_FOR_REACH_ACCEPTANCE">;
282
291
  wind: Wind;
283
292
  reacherInfo: {
284
- wind: Wind;
285
- tile: string;
293
+ readonly wind: Wind;
294
+ readonly tile: string;
286
295
  };
287
- choices: Pick<DiscardedChoice, "RON">;
296
+ choices: Pick<DiscardChoice, "RON">;
288
297
  }
289
298
 
299
+ export declare const compareCalledTiles: (arr: readonly Tile[]) => Tile[];
300
+
290
301
  export declare const compareTiles: (i: Tile, j: Tile) => number;
291
302
 
292
303
  export declare class Controller {
@@ -294,8 +305,8 @@ export declare class Controller {
294
305
  playerIDs: string[];
295
306
  actor: Actor<StateMachine< {
296
307
  currentWind: Wind;
297
- oneShotMap: { [key in Wind]: boolean; };
298
- missingMap: { [key in Wind]: boolean; };
308
+ oneShotMap: { [w in Wind]: boolean; };
309
+ missingMap: { [w in Wind]: boolean; };
299
310
  controller: Controller;
300
311
  genEventID: ReturnType<incrementalIDGenerator>;
301
312
  }, {
@@ -351,7 +362,7 @@ export declare class Controller {
351
362
  block: BlockDaiKan;
352
363
  iam: Wind;
353
364
  } | {
354
- type: "DRAWN_GAME_BY_NINE_ORPHANS";
365
+ type: "DRAWN_GAME_BY_NINE_TERMINALS";
355
366
  iam: Wind;
356
367
  }, Record<string, AnyActorRef>, ProvidedActor, ParameterizedObject, ParameterizedObject, never, StateValue, string, unknown, NonReducibleUnknown, EventObject, MetaObject, any>>;
357
368
  observer: Observer;
@@ -361,13 +372,21 @@ export declare class Controller {
361
372
  mailBox: {
362
373
  [id: string]: PlayerEvent[];
363
374
  };
364
- histories: GameHistory[];
375
+ histories: RoundHistory[];
365
376
  debugMode: boolean;
366
- constructor(players: PlayerSession[], params?: {
377
+ constructor(players: readonly PlayerSession[], params?: {
367
378
  debug?: boolean;
368
379
  shuffle?: boolean;
369
380
  });
370
- boardParams(w: Wind): BoardContext;
381
+ getBaseBoardParams(w: Wind): {
382
+ doraIndicators: readonly Tile[];
383
+ round: Round;
384
+ myWind: Wind;
385
+ sticks: {
386
+ readonly reach: number;
387
+ readonly dead: number;
388
+ };
389
+ };
371
390
  hand(w: Wind): ActorHand;
372
391
  get placeManager(): PlaceManager;
373
392
  get scoreManager(): ScoreManager;
@@ -375,9 +394,9 @@ export declare class Controller {
375
394
  next(force?: boolean): void;
376
395
  emit(e: PlayerEvent): void;
377
396
  enqueue(event: PlayerEvent): void;
378
- pollReplies(eventID: string, wind: Wind[]): void;
379
- export(): GameHistory[];
380
- static load(h: GameHistory): Controller;
397
+ pollReplies(eventID: string, wind: readonly Wind[]): void;
398
+ export(): RoundHistory[];
399
+ static load(h: RoundHistory): Controller;
381
400
  start(): void;
382
401
  startGame(): void;
383
402
  finalResult(ret: WinResult, iam: Wind): WinResult;
@@ -388,31 +407,29 @@ export declare class Controller {
388
407
  missingRon?: boolean;
389
408
  discardedBy?: Wind;
390
409
  }): WinResult | false;
391
- doPon(w: Wind, discardedBy: Wind, t?: Tile): BlockPon[] | false;
392
- doChi(w: Wind, discardedBy: Wind, t?: Tile): BlockChi[] | false;
393
- redPattern(blocks: BlockChi[]): BlockChi[];
394
- doReach(w: Wind): TileAnalysis[] | false;
395
- doDiscard(w: Wind, called?: BlockChi | BlockPon): Tile[];
396
- cannotDiscardTile(b: BlockChi): Tile[];
397
- doAnKan(w: Wind): BlockAnKan[] | false;
398
- doShoKan(w: Wind): BlockShoKan[] | false;
410
+ doPon(w: Wind, discardedBy: Wind, t?: Tile): readonly BlockPon[] | false;
411
+ doChi(w: Wind, discardedBy: Wind, t?: Tile): readonly BlockChi[] | false;
412
+ doReach(w: Wind): readonly TileAnalysis[] | false;
413
+ doDiscard(w: Wind, called?: BlockChi | BlockPon): readonly Tile[];
414
+ doAnKan(w: Wind): readonly BlockAnKan[] | false;
415
+ doShoKan(w: Wind): readonly BlockShoKan[] | false;
399
416
  doDaiKan(w: Wind, discardedBy: Wind, t: Tile): BlockDaiKan | false;
400
- canDrawnGame(w: Wind): boolean;
417
+ canDeclareNineTerminalsAbort(w: Wind): boolean;
401
418
  initialHands(): {
402
- "1z": string;
403
- "2z": string;
404
- "3z": string;
405
- "4z": string;
419
+ readonly "1z": string;
420
+ readonly "2z": string;
421
+ readonly "3z": string;
422
+ readonly "4z": string;
406
423
  };
407
424
  }
408
425
 
409
426
  declare type ControllerContext = {
410
427
  currentWind: Wind;
411
428
  oneShotMap: {
412
- [key in Wind]: boolean;
429
+ [w in Wind]: boolean;
413
430
  };
414
431
  missingMap: {
415
- [key in Wind]: boolean;
432
+ [w in Wind]: boolean;
416
433
  };
417
434
  controller: Controller;
418
435
  genEventID: ReturnType<typeof incrementalIDGenerator>;
@@ -427,23 +444,10 @@ export declare const convertInput: (i: TableInput) => {
427
444
  export declare class Counter {
428
445
  disabled: boolean;
429
446
  private c;
430
- safeTileMap: {
431
- "1z": {
432
- [name: string]: boolean;
433
- };
434
- "2z": {
435
- [name: string]: boolean;
436
- };
437
- "3z": {
438
- [name: string]: boolean;
439
- };
440
- "4z": {
441
- [name: string]: boolean;
442
- };
443
- };
447
+ private safeTileMap;
444
448
  constructor(disabled?: boolean);
445
449
  get(t: Tile): number;
446
- dec(...tiles: Tile[]): void;
450
+ dec(...tiles: readonly Tile[]): void;
447
451
  addTileToSafeMap(t: Tile, targetUser: Wind): void;
448
452
  isSafeTile(k: Type, n: number, targetUser: Wind): boolean;
449
453
  private key;
@@ -451,7 +455,7 @@ export declare class Counter {
451
455
  private initial;
452
456
  }
453
457
 
454
- export declare const createBlockHand: (helper: ImageHelper, blocks: Block[], options?: DrawOptions) => MySVGElement;
458
+ export declare const createBlockHand: (helper: ImageHelper, blocks: readonly Block[], options?: DrawOptions) => MySVGElement;
455
459
 
456
460
  export declare const createControllerMachine: (c: Controller) => StateMachine<ControllerContext, {
457
461
  type: "";
@@ -506,7 +510,7 @@ type: "DAI_KAN";
506
510
  block: BlockDaiKan;
507
511
  iam: Wind;
508
512
  } | {
509
- type: "DRAWN_GAME_BY_NINE_ORPHANS";
513
+ type: "DRAWN_GAME_BY_NINE_TERMINALS";
510
514
  iam: Wind;
511
515
  }, Record<string, AnyActorRef>, ProvidedActor, ParameterizedObject, ParameterizedObject, never, StateValue, string, unknown, NonReducibleUnknown, EventObject, MetaObject, any>;
512
516
 
@@ -536,22 +540,23 @@ export declare const createLocalGame: (params?: {
536
540
 
537
541
  export declare const createTable: (helper: ImageHelper, fontCtx: FontContext, handsProps: HandsInput, discardsProps: DiscardsInput, scoreBoardProps: ScoreBoardInput) => MySVGElement;
538
542
 
539
- export declare function createWindMap<T>(initial: T, clone?: boolean): {
540
- "1z": T;
541
- "2z": T;
542
- "3z": T;
543
- "4z": T;
544
- };
543
+ export declare function createWindMap<T>(factory: () => T): WindMap<T>;
545
544
 
546
545
  export declare const deserializeWinResult: (ret: SerializedWinResult) => WinResult;
547
546
 
548
- declare interface DiscardedChoice {
547
+ declare interface DiscardChoice {
549
548
  RON: false | SerializedWinResult;
550
- PON: false | SerializedBlock[];
551
- CHI: false | SerializedBlock[];
549
+ PON: false | readonly SerializedBlock[];
550
+ CHI: false | readonly SerializedBlock[];
552
551
  DAI_KAN: false | SerializedBlock;
553
552
  }
554
553
 
554
+ declare type DiscardEntry = {
555
+ w: Wind;
556
+ t: Tile;
557
+ callMarker?: boolean;
558
+ };
559
+
555
560
  export declare interface DiscardEvent {
556
561
  id: string;
557
562
  type: Extract<ChoiceEvent, "DISCARD">;
@@ -571,28 +576,37 @@ export declare interface DistributeEvent {
571
576
  id: string;
572
577
  type: Extract<Event_2, "DISTRIBUTE">;
573
578
  hands: {
574
- [key in Wind]: string;
579
+ readonly [w in Wind]: string;
575
580
  };
576
581
  wind: Wind;
577
582
  doraIndicator: string;
578
- players: string[];
583
+ players: readonly string[];
579
584
  places: {
580
- [key: string]: Wind;
585
+ readonly [id: string]: Wind;
581
586
  };
582
587
  sticks: {
583
- reach: number;
584
- dead: number;
588
+ readonly reach: number;
589
+ readonly dead: number;
585
590
  };
586
591
  round: Round;
587
592
  scores: {
588
- [key: string]: number;
593
+ readonly [key: string]: number;
589
594
  };
590
595
  }
591
596
 
592
- export declare const drawBlocks: (svg: Svg, blocks: Block[], config?: ImageHelperConfig, options?: {
597
+ export declare const drawBlocks: (svg: Svg, blocks: readonly Block[], config?: ImageHelperConfig, options?: {
593
598
  responsive?: boolean;
594
599
  } & DrawOptions) => void;
595
600
 
601
+ declare interface DrawChoice {
602
+ TSUMO: false | SerializedWinResult;
603
+ REACH: false | readonly SerializedTileAnalysis[];
604
+ AN_KAN: false | readonly SerializedBlock[];
605
+ SHO_KAN: false | readonly SerializedBlock[];
606
+ DISCARD: false | readonly string[];
607
+ DRAWN_GAME_BY_NINE_TERMINALS: boolean;
608
+ }
609
+
596
610
  export declare interface DrawEvent {
597
611
  id: string;
598
612
  type: Extract<Event_2, "DRAW">;
@@ -602,15 +616,6 @@ export declare interface DrawEvent {
602
616
  tile: string;
603
617
  }
604
618
 
605
- declare interface DrawnChoice {
606
- TSUMO: false | SerializedWinResult;
607
- REACH: false | SerializedTileAnalysis[];
608
- AN_KAN: false | SerializedBlock[];
609
- SHO_KAN: false | SerializedBlock[];
610
- DISCARD: false | string[];
611
- DRAWN_GAME_BY_NINE_ORPHANS: boolean;
612
- }
613
-
614
619
  export declare interface DrawOptions {
615
620
  enableDoraText?: boolean;
616
621
  enableTsumoText?: boolean;
@@ -621,13 +626,13 @@ export declare const drawTable: (svg: Svg, tableInput: string, config: ImageHelp
621
626
  }) => void;
622
627
 
623
628
  export declare class Efficiency {
624
- static calcEffectiveTiles(hand: Hand, choices: Tile[], options?: {
629
+ static calcEffectiveTiles(hand: Hand, choices: readonly Tile[], options?: {
625
630
  arrangeRed?: boolean;
626
631
  standardTypeOnly?: boolean;
627
- }): TileAnalysis[];
632
+ }): readonly TileAnalysis[];
628
633
  static getEffectiveTiles(hand: Hand, options?: {
629
634
  standardTypeOnly?: boolean;
630
- typeFilter?: Type[];
635
+ typeFilter?: readonly Type[];
631
636
  }): {
632
637
  shanten: number;
633
638
  effectiveTiles: Tile[];
@@ -637,20 +642,20 @@ export declare class Efficiency {
637
642
  export declare interface EndEvent {
638
643
  id: string;
639
644
  type: Extract<Event_2, "END_GAME">;
640
- subType: "WIN_GAME" | "DRAWN_GAME" | "FOUR_KAN" | "FOUR_WIND" | "NINE_TILES";
645
+ subType: "WIN_GAME" | "DRAWN_GAME" | "FOUR_KANS" | "FOUR_WINDS" | "NINE_TERMINALS";
641
646
  wind: Wind;
642
647
  scores: {
643
- [key: string]: number;
648
+ readonly [key: string]: number;
644
649
  };
645
650
  sticks: {
646
- reach: number;
647
- dead: number;
651
+ readonly reach: number;
652
+ readonly dead: number;
648
653
  };
649
654
  deltas: {
650
- [key in Wind]: number;
655
+ readonly [w in Wind]: number;
651
656
  };
652
657
  hands: {
653
- [key in Wind]: string;
658
+ readonly [w in Wind]: string;
654
659
  };
655
660
  shouldContinue: boolean;
656
661
  }
@@ -679,8 +684,8 @@ export declare interface FontContext {
679
684
 
680
685
  export declare function forHand(options?: {
681
686
  skipBack?: boolean;
682
- filterBy?: Type[];
683
- }): Generator<readonly ["m" | "p" | "s" | "z" | "_", number], void, unknown>;
687
+ filterBy?: readonly Type[];
688
+ }): Generator<readonly [Type, number], void, unknown>;
684
689
 
685
690
  export declare class G extends Mark {
686
691
  children: Mark[];
@@ -695,24 +700,6 @@ export declare class G extends Mark {
695
700
  each(block: (idx: number, children: Mark[]) => void, deep: boolean): void;
696
701
  }
697
702
 
698
- export declare interface GameHistory {
699
- round: Round;
700
- scores: {
701
- [wind in string]: number;
702
- };
703
- players: {
704
- [id in string]: Wind;
705
- };
706
- sticks: {
707
- reach: number;
708
- dead: number;
709
- };
710
- wall: WallProps;
711
- choiceEvents: {
712
- [id: string]: PlayerEvent[];
713
- };
714
- }
715
-
716
703
  export declare const getCallBlockIndex: (caller: Wind, discardedBy: Wind, type: typeof BLOCK.PON | typeof BLOCK.DAI_KAN) => 0 | 1 | 3 | 2;
717
704
 
718
705
  export declare function getPointDescription(params: {
@@ -727,7 +714,7 @@ export declare function getPointDescription(params: {
727
714
 
728
715
  export declare class Hand {
729
716
  protected data: HandData;
730
- constructor(input: string | Block[], allowBackBlock?: boolean);
717
+ constructor(input: string | readonly Block[], allowBackBlock?: boolean);
731
718
  private init;
732
719
  get hands(): Tile[];
733
720
  toString(): string;
@@ -759,10 +746,10 @@ export declare interface HandData {
759
746
  }
760
747
 
761
748
  export declare interface HandsInput {
762
- front: Block[];
763
- right: Block[];
764
- opposite: Block[];
765
- left: Block[];
749
+ front: readonly Block[];
750
+ right: readonly Block[];
751
+ opposite: readonly Block[];
752
+ left: readonly Block[];
766
753
  }
767
754
 
768
755
  declare class Image_2 extends Mark {
@@ -803,18 +790,11 @@ export declare const INPUT_SEPARATOR = ",";
803
790
 
804
791
  export declare interface IRiver {
805
792
  discard(t: Tile, w: Wind): void;
806
- discards(w?: Wind): {
807
- w: Wind;
808
- t: Tile;
809
- callMarker?: boolean;
810
- }[];
811
- lastTile: {
812
- w: Wind;
813
- t: Tile;
814
- callMarker?: boolean;
815
- };
793
+ discards(w?: Wind): readonly DiscardEntry[];
794
+ lastTile: DiscardEntry;
816
795
  markCalled(): void;
817
- cannotContinue(): boolean;
796
+ isFourWindsAbort(): boolean;
797
+ reset(): void;
818
798
  }
819
799
 
820
800
  export declare function is5Tile(t: Tile): boolean;
@@ -829,10 +809,10 @@ export declare interface IWall {
829
809
  canDraw: boolean;
830
810
  export(): WallProps;
831
811
  initialHands(): {
832
- [WIND.E]: string;
833
- [WIND.S]: string;
834
- [WIND.W]: string;
835
- [WIND.N]: string;
812
+ readonly [WIND.E]: string;
813
+ readonly [WIND.S]: string;
814
+ readonly [WIND.W]: string;
815
+ readonly [WIND.N]: string;
836
816
  };
837
817
  }
838
818
 
@@ -931,10 +911,14 @@ export declare const parse: (s: string) => {
931
911
 
932
912
  export declare class Parser {
933
913
  readonly input: string;
934
- readonly enableImplicitTsumoBlock: boolean;
914
+ readonly options: {
915
+ enableImplicitTsumoBlock?: boolean;
916
+ };
935
917
  readonly maxInputLength = 600;
936
- constructor(input: string, enableImplicitTsumoBlock?: boolean);
937
- parse(): (BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair)[];
918
+ constructor(input: string, options?: {
919
+ enableImplicitTsumoBlock?: boolean;
920
+ });
921
+ parse(): readonly Block[];
938
922
  tiles(): readonly Tile[];
939
923
  tileSeparators(): readonly (Tile | Separator)[];
940
924
  private reconstruct;
@@ -977,20 +961,22 @@ export declare const parseTableInput: (s: string) => {
977
961
  export declare class PlaceManager {
978
962
  private playerToWind;
979
963
  private windToPlayer;
980
- round: Round;
981
- sticks: {
982
- reach: number;
983
- dead: number;
984
- };
964
+ private _round;
965
+ private _sticks;
985
966
  constructor(initial: {
986
- [key: string]: Wind;
967
+ readonly [key: string]: Wind;
987
968
  }, params?: {
988
- round: Round;
989
- sticks: {
990
- reach: number;
991
- dead: number;
969
+ readonly round: Round;
970
+ readonly sticks: {
971
+ readonly reach: number;
972
+ readonly dead: number;
992
973
  };
993
974
  });
975
+ get sticks(): {
976
+ readonly reach: number;
977
+ readonly dead: number;
978
+ };
979
+ get round(): Round;
994
980
  private update;
995
981
  incrementDeadStick(): void;
996
982
  incrementReachStick(): void;
@@ -1001,7 +987,7 @@ export declare class PlaceManager {
1001
987
  wind(id: string): Wind;
1002
988
  playerID(w: Wind): string;
1003
989
  get playerMap(): {
1004
- [id: string]: Wind;
990
+ readonly [id: string]: Wind;
1005
991
  };
1006
992
  }
1007
993
 
@@ -1016,8 +1002,8 @@ export declare class Player extends BaseActor {
1016
1002
  }
1017
1003
 
1018
1004
  export declare class PlayerEfficiency {
1019
- static analyzePlayerEfficiency(counter: Counter, analyses: TileAnalysis[]): PlayerTileAnalysis[];
1020
- static selectMinPriority(c: Counter, playerAnalyses: PlayerTileAnalysis[], doras: Tile[]): PlayerTileAnalysis;
1005
+ static analyzePlayerEfficiency(counter: Counter, analyses: readonly TileAnalysis[]): PlayerTileAnalysis[];
1006
+ static selectMinPriority(c: Counter, playerAnalyses: readonly PlayerTileAnalysis[], doras: Tile[]): PlayerTileAnalysis;
1021
1007
  private static calcPriority;
1022
1008
  }
1023
1009
 
@@ -1031,7 +1017,7 @@ export declare interface PlayerSession {
1031
1017
  export declare interface PlayerTileAnalysis {
1032
1018
  tile: Tile;
1033
1019
  sum: number;
1034
- effectiveTiles: {
1020
+ effectiveTiles: readonly {
1035
1021
  tile: Tile;
1036
1022
  count: number;
1037
1023
  }[];
@@ -1061,8 +1047,8 @@ export declare class PointCalculator {
1061
1047
  orig: BoardContext;
1062
1048
  };
1063
1049
  constructor(hand: Hand, params: BoardContext);
1064
- calc(...hands: readonly Block[][]): WinResult | false;
1065
- getWinningHands(hands: readonly Block[][]): WinningHand[];
1050
+ calc(...hands: readonly (readonly Block[])[]): WinResult | false;
1051
+ getWinningHands(hands: readonly (readonly Block[])[]): WinningHand[];
1066
1052
  private selectBestHand;
1067
1053
  private calculateScore;
1068
1054
  private hasYakuman;
@@ -1074,43 +1060,43 @@ export declare class PointCalculator {
1074
1060
  private addStickPoints;
1075
1061
  private getBasePoints;
1076
1062
  private getCalledPenalty;
1077
- dA1(h: readonly Block[]): Yaku[];
1078
- dB1(h: readonly Block[]): Yaku[];
1079
- dC1(h: readonly Block[]): Yaku[];
1080
- dD1(h: readonly Block[]): Yaku[];
1081
- dE1(h: readonly Block[]): Yaku[];
1082
- dF1(h: readonly Block[]): Yaku[];
1083
- dG1(h: readonly Block[]): Yaku[];
1084
- dH1(h: readonly Block[]): Yaku[];
1085
- dI1(h: readonly Block[]): Yaku[];
1086
- dJ1(h: readonly Block[]): Yaku[];
1087
- dK1(h: readonly Block[]): Yaku[];
1088
- dX1(h: readonly Block[]): Yaku[];
1089
- dA2(h: readonly Block[]): Yaku[];
1090
- dB2(h: readonly Block[]): Yaku[];
1091
- dC2(h: readonly Block[]): Yaku[];
1092
- dD2(h: readonly Block[]): Yaku[];
1093
- dE2(h: readonly Block[]): Yaku[];
1094
- dF2(h: readonly Block[]): Yaku[];
1095
- dG2(h: readonly Block[]): Yaku[];
1096
- dH2(h: readonly Block[]): Yaku[];
1097
- dI2(h: readonly Block[]): Yaku[];
1098
- dJ2(h: readonly Block[]): Yaku[];
1099
- dA3(h: readonly Block[]): Yaku[];
1100
- dB3(h: readonly Block[]): Yaku[];
1101
- dC3(h: readonly Block[]): Yaku[];
1102
- dA6(h: readonly Block[]): Yaku[];
1103
- dA13(h: readonly Block[]): Yaku[];
1104
- dB13(h: readonly Block[]): Yaku[];
1105
- dC13(h: readonly Block[]): Yaku[];
1106
- dD13(h: readonly Block[]): Yaku[];
1107
- dE13(h: readonly Block[]): Yaku[];
1108
- dF13(h: readonly Block[]): Yaku[];
1109
- dG13(h: readonly Block[]): Yaku[];
1110
- dH13(h: readonly Block[]): Yaku[];
1111
- dI13(h: readonly Block[]): Yaku[];
1112
- dJ13(h: readonly Block[]): Yaku[];
1113
- dK13(h: readonly Block[]): Yaku[];
1063
+ dA1(h: readonly Block[]): readonly Yaku[];
1064
+ dB1(h: readonly Block[]): readonly Yaku[];
1065
+ dC1(h: readonly Block[]): readonly Yaku[];
1066
+ dD1(h: readonly Block[]): readonly Yaku[];
1067
+ dE1(h: readonly Block[]): readonly Yaku[];
1068
+ dF1(h: readonly Block[]): readonly Yaku[];
1069
+ dG1(h: readonly Block[]): readonly Yaku[];
1070
+ dH1(h: readonly Block[]): readonly Yaku[];
1071
+ dI1(h: readonly Block[]): readonly Yaku[];
1072
+ dJ1(h: readonly Block[]): readonly Yaku[];
1073
+ dK1(h: readonly Block[]): readonly Yaku[];
1074
+ dX1(h: readonly Block[]): readonly Yaku[];
1075
+ dA2(h: readonly Block[]): readonly Yaku[];
1076
+ dB2(h: readonly Block[]): readonly Yaku[];
1077
+ dC2(h: readonly Block[]): readonly Yaku[];
1078
+ dD2(h: readonly Block[]): readonly Yaku[];
1079
+ dE2(h: readonly Block[]): readonly Yaku[];
1080
+ dF2(h: readonly Block[]): readonly Yaku[];
1081
+ dG2(h: readonly Block[]): readonly Yaku[];
1082
+ dH2(h: readonly Block[]): readonly Yaku[];
1083
+ dI2(h: readonly Block[]): readonly Yaku[];
1084
+ dJ2(h: readonly Block[]): readonly Yaku[];
1085
+ dA3(h: readonly Block[]): readonly Yaku[];
1086
+ dB3(h: readonly Block[]): readonly Yaku[];
1087
+ dC3(h: readonly Block[]): readonly Yaku[];
1088
+ dA6(h: readonly Block[]): readonly Yaku[];
1089
+ dA13(h: readonly Block[]): readonly Yaku[];
1090
+ dB13(h: readonly Block[]): readonly Yaku[];
1091
+ dC13(h: readonly Block[]): readonly Yaku[];
1092
+ dD13(h: readonly Block[]): readonly Yaku[];
1093
+ dE13(h: readonly Block[]): readonly Yaku[];
1094
+ dF13(h: readonly Block[]): readonly Yaku[];
1095
+ dG13(h: readonly Block[]): readonly Yaku[];
1096
+ dH13(h: readonly Block[]): readonly Yaku[];
1097
+ dI13(h: readonly Block[]): readonly Yaku[];
1098
+ dJ13(h: readonly Block[]): readonly Yaku[];
1099
+ dK13(h: readonly Block[]): readonly Yaku[];
1114
1100
  calcFu(h: readonly Block[]): number;
1115
1101
  }
1116
1102
 
@@ -1120,12 +1106,12 @@ export declare const prevWind: (w: Wind) => Wind;
1120
1106
 
1121
1107
  export declare function prioritizeDiscardedEvents(events: ChoiceAfterDiscardedEvent[]): {
1122
1108
  events: ChoiceAfterDiscardedEvent[];
1123
- type: boolean | keyof DiscardedChoice;
1109
+ type: boolean | keyof DiscardChoice;
1124
1110
  };
1125
1111
 
1126
1112
  export declare function prioritizeDrawnEvents(events: ChoiceAfterDrawnEvent[]): {
1127
1113
  events: ChoiceAfterDrawnEvent[];
1128
- type: boolean | keyof DrawnChoice;
1114
+ type: boolean | keyof DrawChoice;
1129
1115
  };
1130
1116
 
1131
1117
  export declare interface ReachAcceptedEvent {
@@ -1133,8 +1119,8 @@ export declare interface ReachAcceptedEvent {
1133
1119
  type: Extract<Event_2, "REACH_ACCEPTED">;
1134
1120
  wind: Wind;
1135
1121
  reacherInfo: {
1136
- wind: Wind;
1137
- tile: string;
1122
+ readonly wind: Wind;
1123
+ readonly tile: string;
1138
1124
  };
1139
1125
  }
1140
1126
 
@@ -1158,7 +1144,7 @@ export declare class Rect extends Mark {
1158
1144
 
1159
1145
  export declare class Replayer {
1160
1146
  index: number;
1161
- histories: GameHistory[];
1147
+ histories: RoundHistory[];
1162
1148
  constructor(v: string);
1163
1149
  next(): void;
1164
1150
  prev(): void;
@@ -1167,28 +1153,21 @@ export declare class Replayer {
1167
1153
  }
1168
1154
 
1169
1155
  export declare class RiskRank {
1170
- static selectTile(c: Counter, targetUsers: Wind[], tiles: Tile[]): Tile;
1171
- static rank(c: Counter, targetUsers: Wind[], t: Tile): number;
1156
+ static selectTile(c: Counter, targetUsers: readonly Wind[], tiles: readonly Tile[]): Tile;
1157
+ static rank(c: Counter, targetUsers: readonly Wind[], t: Tile): number;
1172
1158
  static rankZ(c: Counter, targetUser: Wind, t: Tile): number;
1173
1159
  static rankN(c: Counter, targetUser: Wind, t: Tile): 0 | 5 | 3 | 4 | 6 | 8 | 12;
1174
1160
  }
1175
1161
 
1176
- export declare class River {
1177
- private m;
1178
- constructor();
1162
+ export declare class River implements IRiver {
1163
+ private all;
1164
+ private byWind;
1179
1165
  discard(t: Tile, w: Wind): void;
1180
- discards(w?: Wind): {
1181
- w: Wind;
1182
- t: Tile;
1183
- callMarker?: boolean;
1184
- }[];
1185
- get lastTile(): {
1186
- w: Wind;
1187
- t: Tile;
1188
- callMarker?: boolean;
1189
- };
1166
+ discards(w?: Wind): readonly DiscardEntry[];
1167
+ get lastTile(): DiscardEntry;
1190
1168
  markCalled(): void;
1191
- cannotContinue(): boolean;
1169
+ isFourWindsAbort(): boolean;
1170
+ reset(): void;
1192
1171
  }
1193
1172
 
1194
1173
  export declare interface RonEvent {
@@ -1198,8 +1177,8 @@ export declare interface RonEvent {
1198
1177
  wind: Wind;
1199
1178
  ret: SerializedWinResult;
1200
1179
  victimInfo: {
1201
- wind: Wind;
1202
- tile: string;
1180
+ readonly wind: Wind;
1181
+ readonly tile: string;
1203
1182
  };
1204
1183
  }
1205
1184
 
@@ -1243,6 +1222,24 @@ export declare const ROUND_MAP: {
1243
1222
  readonly "4z4": "北4局";
1244
1223
  };
1245
1224
 
1225
+ export declare interface RoundHistory {
1226
+ round: Round;
1227
+ scores: {
1228
+ [wind in string]: number;
1229
+ };
1230
+ players: {
1231
+ [id in string]: Wind;
1232
+ };
1233
+ sticks: {
1234
+ reach: number;
1235
+ dead: number;
1236
+ };
1237
+ wall: WallProps;
1238
+ choiceEvents: {
1239
+ [id: string]: PlayerEvent[];
1240
+ };
1241
+ }
1242
+
1246
1243
  export declare const roundWind: (r: Round) => Wind;
1247
1244
 
1248
1245
  export declare interface ScoreBoardInput {
@@ -1265,16 +1262,16 @@ export declare class ScoreManager {
1265
1262
  private reachValue;
1266
1263
  private m;
1267
1264
  constructor(initial: {
1268
- [key: string]: number;
1265
+ readonly [id: string]: number;
1269
1266
  });
1270
1267
  get summary(): {
1271
- [key: string]: number;
1268
+ readonly [id: string]: number;
1272
1269
  };
1273
1270
  reach(id: string): void;
1274
1271
  update(result: {
1275
- [w in Wind]: number;
1272
+ readonly [w in Wind]: number;
1276
1273
  }, windMap: {
1277
- [id: string]: Wind;
1274
+ readonly [id: string]: Wind;
1278
1275
  }): void;
1279
1276
  }
1280
1277
 
@@ -1314,8 +1311,6 @@ export declare class ShantenCalculator {
1314
1311
 
1315
1312
  export declare function shuffle<T>(array: T[]): T[];
1316
1313
 
1317
- export declare const sortCalledTiles: (arr: readonly Tile[]) => Tile[];
1318
-
1319
1314
  export declare const STICK_CONTEXT: {
1320
1315
  readonly WIDTH: 125;
1321
1316
  readonly HEIGHT: 27.5;
@@ -1509,12 +1504,7 @@ export declare class Wall {
1509
1504
  get hiddenDoraIndicators(): Tile[];
1510
1505
  get canKan(): boolean;
1511
1506
  get canDraw(): boolean;
1512
- initialHands(): {
1513
- "1z": string;
1514
- "2z": string;
1515
- "3z": string;
1516
- "4z": string;
1517
- };
1507
+ initialHands(): WindMap<string>;
1518
1508
  private init;
1519
1509
  export(): WallProps;
1520
1510
  static clone(walls: WallProps): WallProps;
@@ -1544,8 +1534,10 @@ export declare const WIND_MAP: {
1544
1534
  readonly "4z": "北";
1545
1535
  };
1546
1536
 
1537
+ export declare type WindMap<T> = Record<Wind, T>;
1538
+
1547
1539
  declare interface WinningHand {
1548
- hand: Block[];
1540
+ hand: readonly Block[];
1549
1541
  fu: number;
1550
1542
  yakus: readonly Yaku[];
1551
1543
  han: number;