@konoui/mjimage 0.7.0 → 0.9.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;
@@ -43,9 +56,10 @@ export declare abstract class BaseActor {
43
56
  "4z": ActorHand;
44
57
  };
45
58
  counter: Counter;
46
- doraIndicators: Tile[];
59
+ private _doraIndicators;
47
60
  eventHandler: EventHandler;
48
61
  constructor(id: string, eventHandler: EventHandler);
62
+ get doraIndicators(): readonly Tile[];
49
63
  hand(w: Wind): ActorHand;
50
64
  protected abstract setHands(e: DistributeEvent): void;
51
65
  handleEvent(e: PlayerEvent): void;
@@ -90,8 +104,8 @@ export declare abstract class Block {
90
104
  private readonly _tiles;
91
105
  private readonly _type;
92
106
  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;
107
+ static from(tiles: string): Block;
108
+ static deserialize(v: SerializedBlock): Block | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockPair | BlockRun | BlockThree | BlockHand | BlockIsolated | BlockOther;
95
109
  serialize(): {
96
110
  tiles: string;
97
111
  type: BlockType;
@@ -110,7 +124,7 @@ export declare abstract class Block {
110
124
  idx: number;
111
125
  tile: Tile;
112
126
  };
113
- }): Block | BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair;
127
+ }): Block | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockPair | BlockRun | BlockThree | BlockHand | BlockIsolated | BlockOther;
114
128
  }
115
129
 
116
130
  export declare class BlockAnKan extends Block {
@@ -124,13 +138,13 @@ export declare class BlockAnKan extends Block {
124
138
  export declare class BlockCalculator {
125
139
  hand: Hand;
126
140
  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[][];
141
+ calc(lastTile: Tile): readonly (readonly Block[])[];
142
+ markedHands(hands: readonly (readonly Block[])[], lastTile: Tile): readonly (readonly Block[])[];
143
+ markedHand(hand: readonly Block[], lastTile: Tile): readonly (readonly Block[])[];
144
+ sevenPairs(): readonly (readonly Block[])[];
145
+ thirteenOrphans(): readonly (readonly Block[])[];
146
+ nineGates(): readonly (readonly Block[])[];
147
+ standardType(): readonly (readonly Block[])[];
134
148
  private calcAllBlockCombinations;
135
149
  private handleBack;
136
150
  private handleZ;
@@ -211,7 +225,7 @@ export declare interface BoardContext {
211
225
  readonly reach: number;
212
226
  readonly dead: number;
213
227
  };
214
- reached?: 1 | 2;
228
+ doubleReached?: boolean;
215
229
  replacementWin?: boolean;
216
230
  quadWin?: boolean;
217
231
  finalWallWin?: boolean;
@@ -238,7 +252,7 @@ export declare interface ChoiceAfterCalled {
238
252
  id: string;
239
253
  type: Extract<Event_2, "CHOICE_AFTER_CALLED">;
240
254
  wind: Wind;
241
- choices: Pick<DrawnChoice, "DISCARD">;
255
+ choices: Pick<DrawChoice, "DISCARD">;
242
256
  }
243
257
 
244
258
  export declare interface ChoiceAfterDiscardedEvent {
@@ -246,10 +260,10 @@ export declare interface ChoiceAfterDiscardedEvent {
246
260
  type: Extract<Event_2, "CHOICE_AFTER_DISCARDED">;
247
261
  wind: Wind;
248
262
  discarterInfo: {
249
- wind: Wind;
250
- tile: string;
263
+ readonly wind: Wind;
264
+ readonly tile: string;
251
265
  };
252
- choices: DiscardedChoice;
266
+ choices: DiscardChoice;
253
267
  }
254
268
 
255
269
  export declare interface ChoiceAfterDrawnEvent {
@@ -257,23 +271,23 @@ export declare interface ChoiceAfterDrawnEvent {
257
271
  type: Extract<Event_2, "CHOICE_AFTER_DRAWN">;
258
272
  wind: Wind;
259
273
  drawerInfo: {
260
- wind: Wind;
261
- tile: string;
274
+ readonly wind: Wind;
275
+ readonly tile: string;
262
276
  };
263
- choices: DrawnChoice;
277
+ choices: DrawChoice;
264
278
  }
265
279
 
266
- declare type ChoiceEvent = "PON" | "CHI" | "RON" | "DISCARD" | "TSUMO" | "REACH" | "AN_KAN" | "SHO_KAN" | "DAI_KAN" | "DRAWN_GAME_BY_NINE_ORPHANS";
280
+ declare type ChoiceEvent = "PON" | "CHI" | "RON" | "DISCARD" | "TSUMO" | "REACH" | "AN_KAN" | "SHO_KAN" | "DAI_KAN" | "DRAWN_GAME_BY_NINE_TERMINALS";
267
281
 
268
282
  export declare interface ChoiceForChanKan {
269
283
  id: string;
270
284
  type: Extract<Event_2, "CHOICE_FOR_CHAN_KAN">;
271
285
  wind: Wind;
272
286
  callerInfo: {
273
- wind: Wind;
274
- tile: string;
287
+ readonly wind: Wind;
288
+ readonly tile: string;
275
289
  };
276
- choices: Pick<DiscardedChoice, "RON">;
290
+ choices: Pick<DiscardChoice, "RON">;
277
291
  }
278
292
 
279
293
  export declare interface ChoiceForReachAcceptance {
@@ -281,10 +295,10 @@ export declare interface ChoiceForReachAcceptance {
281
295
  type: Extract<Event_2, "CHOICE_FOR_REACH_ACCEPTANCE">;
282
296
  wind: Wind;
283
297
  reacherInfo: {
284
- wind: Wind;
285
- tile: string;
298
+ readonly wind: Wind;
299
+ readonly tile: string;
286
300
  };
287
- choices: Pick<DiscardedChoice, "RON">;
301
+ choices: Pick<DiscardChoice, "RON">;
288
302
  }
289
303
 
290
304
  export declare const compareTiles: (i: Tile, j: Tile) => number;
@@ -294,8 +308,8 @@ export declare class Controller {
294
308
  playerIDs: string[];
295
309
  actor: Actor<StateMachine< {
296
310
  currentWind: Wind;
297
- oneShotMap: { [key in Wind]: boolean; };
298
- missingMap: { [key in Wind]: boolean; };
311
+ oneShotMap: { [w in Wind]: boolean; };
312
+ missingMap: { [w in Wind]: boolean; };
299
313
  controller: Controller;
300
314
  genEventID: ReturnType<incrementalIDGenerator>;
301
315
  }, {
@@ -351,7 +365,7 @@ export declare class Controller {
351
365
  block: BlockDaiKan;
352
366
  iam: Wind;
353
367
  } | {
354
- type: "DRAWN_GAME_BY_NINE_ORPHANS";
368
+ type: "DRAWN_GAME_BY_NINE_TERMINALS";
355
369
  iam: Wind;
356
370
  }, Record<string, AnyActorRef>, ProvidedActor, ParameterizedObject, ParameterizedObject, never, StateValue, string, unknown, NonReducibleUnknown, EventObject, MetaObject, any>>;
357
371
  observer: Observer;
@@ -361,13 +375,21 @@ export declare class Controller {
361
375
  mailBox: {
362
376
  [id: string]: PlayerEvent[];
363
377
  };
364
- histories: GameHistory[];
378
+ histories: RoundHistory[];
365
379
  debugMode: boolean;
366
- constructor(players: PlayerSession[], params?: {
380
+ constructor(players: readonly PlayerSession[], params?: {
367
381
  debug?: boolean;
368
382
  shuffle?: boolean;
369
383
  });
370
- boardParams(w: Wind): BoardContext;
384
+ getBaseBoardParams(w: Wind): {
385
+ doraIndicators: readonly Tile[];
386
+ round: Round;
387
+ myWind: Wind;
388
+ sticks: {
389
+ readonly reach: number;
390
+ readonly dead: number;
391
+ };
392
+ };
371
393
  hand(w: Wind): ActorHand;
372
394
  get placeManager(): PlaceManager;
373
395
  get scoreManager(): ScoreManager;
@@ -375,9 +397,9 @@ export declare class Controller {
375
397
  next(force?: boolean): void;
376
398
  emit(e: PlayerEvent): void;
377
399
  enqueue(event: PlayerEvent): void;
378
- pollReplies(eventID: string, wind: Wind[]): void;
379
- export(): GameHistory[];
380
- static load(h: GameHistory): Controller;
400
+ pollReplies(eventID: string, wind: readonly Wind[]): void;
401
+ export(): RoundHistory[];
402
+ static load(h: RoundHistory): Controller;
381
403
  start(): void;
382
404
  startGame(): void;
383
405
  finalResult(ret: WinResult, iam: Wind): WinResult;
@@ -388,31 +410,29 @@ export declare class Controller {
388
410
  missingRon?: boolean;
389
411
  discardedBy?: Wind;
390
412
  }): 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;
413
+ doPon(w: Wind, discardedBy: Wind, t?: Tile): readonly BlockPon[] | false;
414
+ doChi(w: Wind, discardedBy: Wind, t?: Tile): readonly BlockChi[] | false;
415
+ doReach(w: Wind): readonly TileAnalysis[] | false;
416
+ doDiscard(w: Wind, called?: BlockChi | BlockPon): readonly Tile[];
417
+ doAnKan(w: Wind): readonly BlockAnKan[] | false;
418
+ doShoKan(w: Wind): readonly BlockShoKan[] | false;
399
419
  doDaiKan(w: Wind, discardedBy: Wind, t: Tile): BlockDaiKan | false;
400
- canDrawnGame(w: Wind): boolean;
420
+ canDeclareNineTerminalsAbort(w: Wind): boolean;
401
421
  initialHands(): {
402
- "1z": string;
403
- "2z": string;
404
- "3z": string;
405
- "4z": string;
422
+ readonly "1z": string;
423
+ readonly "2z": string;
424
+ readonly "3z": string;
425
+ readonly "4z": string;
406
426
  };
407
427
  }
408
428
 
409
429
  declare type ControllerContext = {
410
430
  currentWind: Wind;
411
431
  oneShotMap: {
412
- [key in Wind]: boolean;
432
+ [w in Wind]: boolean;
413
433
  };
414
434
  missingMap: {
415
- [key in Wind]: boolean;
435
+ [w in Wind]: boolean;
416
436
  };
417
437
  controller: Controller;
418
438
  genEventID: ReturnType<typeof incrementalIDGenerator>;
@@ -425,25 +445,12 @@ export declare const convertInput: (i: TableInput) => {
425
445
  };
426
446
 
427
447
  export declare class Counter {
428
- disable: boolean;
448
+ disabled: boolean;
429
449
  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
- };
444
- constructor(disable?: boolean);
450
+ private safeTileMap;
451
+ constructor(disabled?: boolean);
445
452
  get(t: Tile): number;
446
- dec(...tiles: Tile[]): void;
453
+ dec(...tiles: readonly Tile[]): void;
447
454
  addTileToSafeMap(t: Tile, targetUser: Wind): void;
448
455
  isSafeTile(k: Type, n: number, targetUser: Wind): boolean;
449
456
  private key;
@@ -451,6 +458,8 @@ export declare class Counter {
451
458
  private initial;
452
459
  }
453
460
 
461
+ export declare const createBlockHand: (helper: ImageHelper, blocks: readonly Block[], options?: DrawOptions) => MySVGElement;
462
+
454
463
  export declare const createControllerMachine: (c: Controller) => StateMachine<ControllerContext, {
455
464
  type: "";
456
465
  } | {
@@ -504,7 +513,7 @@ type: "DAI_KAN";
504
513
  block: BlockDaiKan;
505
514
  iam: Wind;
506
515
  } | {
507
- type: "DRAWN_GAME_BY_NINE_ORPHANS";
516
+ type: "DRAWN_GAME_BY_NINE_TERMINALS";
508
517
  iam: Wind;
509
518
  }, Record<string, AnyActorRef>, ProvidedActor, ParameterizedObject, ParameterizedObject, never, StateValue, string, unknown, NonReducibleUnknown, EventObject, MetaObject, any>;
510
519
 
@@ -515,12 +524,6 @@ export declare const createEventEmitter: () => {
515
524
 
516
525
  export declare const createEventPipe: () => [EventHandler, EventHandler];
517
526
 
518
- export declare const createHand: (helper: ImageHelper, blocks: Block[], options?: DrawOptions) => {
519
- e: G;
520
- width: number;
521
- height: number;
522
- };
523
-
524
527
  export declare const createLocalGame: (params?: {
525
528
  debug?: boolean;
526
529
  shuffle?: boolean;
@@ -538,11 +541,7 @@ export declare const createLocalGame: (params?: {
538
541
  p4: Player;
539
542
  };
540
543
 
541
- export declare const createTable: (helper: ImageHelper, fontCtx: FontContext, handsProps: HandsInput, discardsProps: DiscardsInput, scoreBoardProps: ScoreBoardInput) => {
542
- e: G;
543
- width: number;
544
- height: number;
545
- };
544
+ export declare const createTable: (helper: ImageHelper, fontCtx: FontContext, handsProps: HandsInput, discardsProps: DiscardsInput, scoreBoardProps: ScoreBoardInput) => MySVGElement;
546
545
 
547
546
  export declare function createWindMap<T>(initial: T, clone?: boolean): {
548
547
  "1z": T;
@@ -553,10 +552,10 @@ export declare function createWindMap<T>(initial: T, clone?: boolean): {
553
552
 
554
553
  export declare const deserializeWinResult: (ret: SerializedWinResult) => WinResult;
555
554
 
556
- declare interface DiscardedChoice {
555
+ declare interface DiscardChoice {
557
556
  RON: false | SerializedWinResult;
558
- PON: false | SerializedBlock[];
559
- CHI: false | SerializedBlock[];
557
+ PON: false | readonly SerializedBlock[];
558
+ CHI: false | readonly SerializedBlock[];
560
559
  DAI_KAN: false | SerializedBlock;
561
560
  }
562
561
 
@@ -579,28 +578,37 @@ export declare interface DistributeEvent {
579
578
  id: string;
580
579
  type: Extract<Event_2, "DISTRIBUTE">;
581
580
  hands: {
582
- [key in Wind]: string;
581
+ readonly [w in Wind]: string;
583
582
  };
584
583
  wind: Wind;
585
584
  doraIndicator: string;
586
- players: string[];
585
+ players: readonly string[];
587
586
  places: {
588
- [key: string]: Wind;
587
+ readonly [id: string]: Wind;
589
588
  };
590
589
  sticks: {
591
- reach: number;
592
- dead: number;
590
+ readonly reach: number;
591
+ readonly dead: number;
593
592
  };
594
593
  round: Round;
595
594
  scores: {
596
- [key: string]: number;
595
+ readonly [key: string]: number;
597
596
  };
598
597
  }
599
598
 
600
- export declare const drawBlocks: (svg: Svg, blocks: Block[], config?: ImageHelperConfig, options?: {
599
+ export declare const drawBlocks: (svg: Svg, blocks: readonly Block[], config?: ImageHelperConfig, options?: {
601
600
  responsive?: boolean;
602
601
  } & DrawOptions) => void;
603
602
 
603
+ declare interface DrawChoice {
604
+ TSUMO: false | SerializedWinResult;
605
+ REACH: false | readonly SerializedTileAnalysis[];
606
+ AN_KAN: false | readonly SerializedBlock[];
607
+ SHO_KAN: false | readonly SerializedBlock[];
608
+ DISCARD: false | readonly string[];
609
+ DRAWN_GAME_BY_NINE_TERMINALS: boolean;
610
+ }
611
+
604
612
  export declare interface DrawEvent {
605
613
  id: string;
606
614
  type: Extract<Event_2, "DRAW">;
@@ -610,18 +618,9 @@ export declare interface DrawEvent {
610
618
  tile: string;
611
619
  }
612
620
 
613
- declare interface DrawnChoice {
614
- TSUMO: false | SerializedWinResult;
615
- REACH: false | SerializedTileAnalysis[];
616
- AN_KAN: false | SerializedBlock[];
617
- SHO_KAN: false | SerializedBlock[];
618
- DISCARD: false | string[];
619
- DRAWN_GAME_BY_NINE_ORPHANS: boolean;
620
- }
621
-
622
621
  export declare interface DrawOptions {
623
- doraText?: boolean;
624
- tsumoText?: boolean;
622
+ enableDoraText?: boolean;
623
+ enableTsumoText?: boolean;
625
624
  }
626
625
 
627
626
  export declare const drawTable: (svg: Svg, tableInput: string, config: ImageHelperConfig | undefined, fontCtx: FontContext, params?: {
@@ -629,13 +628,13 @@ export declare const drawTable: (svg: Svg, tableInput: string, config: ImageHelp
629
628
  }) => void;
630
629
 
631
630
  export declare class Efficiency {
632
- static calcEffectiveTiles(hand: Hand, choices: Tile[], options?: {
631
+ static calcEffectiveTiles(hand: Hand, choices: readonly Tile[], options?: {
633
632
  arrangeRed?: boolean;
634
633
  standardTypeOnly?: boolean;
635
- }): TileAnalysis[];
634
+ }): readonly TileAnalysis[];
636
635
  static getEffectiveTiles(hand: Hand, options?: {
637
636
  standardTypeOnly?: boolean;
638
- typeFilter?: Type[];
637
+ typeFilter?: readonly Type[];
639
638
  }): {
640
639
  shanten: number;
641
640
  effectiveTiles: Tile[];
@@ -645,20 +644,20 @@ export declare class Efficiency {
645
644
  export declare interface EndEvent {
646
645
  id: string;
647
646
  type: Extract<Event_2, "END_GAME">;
648
- subType: "WIN_GAME" | "DRAWN_GAME" | "FOUR_KAN" | "FOUR_WIND" | "NINE_TILES";
647
+ subType: "WIN_GAME" | "DRAWN_GAME" | "FOUR_KANS" | "FOUR_WINDS" | "NINE_TERMINALS";
649
648
  wind: Wind;
650
649
  scores: {
651
- [key: string]: number;
650
+ readonly [key: string]: number;
652
651
  };
653
652
  sticks: {
654
- reach: number;
655
- dead: number;
653
+ readonly reach: number;
654
+ readonly dead: number;
656
655
  };
657
656
  deltas: {
658
- [key in Wind]: number;
657
+ readonly [w in Wind]: number;
659
658
  };
660
659
  hands: {
661
- [key in Wind]: string;
660
+ readonly [w in Wind]: string;
662
661
  };
663
662
  shouldContinue: boolean;
664
663
  }
@@ -687,8 +686,8 @@ export declare interface FontContext {
687
686
 
688
687
  export declare function forHand(options?: {
689
688
  skipBack?: boolean;
690
- filterBy?: Type[];
691
- }): Generator<readonly ["m" | "p" | "s" | "z" | "_", number], void, unknown>;
689
+ filterBy?: readonly Type[];
690
+ }): Generator<readonly [Type, number], void, unknown>;
692
691
 
693
692
  export declare class G extends Mark {
694
693
  children: Mark[];
@@ -703,24 +702,6 @@ export declare class G extends Mark {
703
702
  each(block: (idx: number, children: Mark[]) => void, deep: boolean): void;
704
703
  }
705
704
 
706
- export declare interface GameHistory {
707
- round: Round;
708
- scores: {
709
- [wind in string]: number;
710
- };
711
- players: {
712
- [id in string]: Wind;
713
- };
714
- sticks: {
715
- reach: number;
716
- dead: number;
717
- };
718
- wall: WallProps;
719
- choiceEvents: {
720
- [id: string]: PlayerEvent[];
721
- };
722
- }
723
-
724
705
  export declare const getCallBlockIndex: (caller: Wind, discardedBy: Wind, type: typeof BLOCK.PON | typeof BLOCK.DAI_KAN) => 0 | 1 | 3 | 2;
725
706
 
726
707
  export declare function getPointDescription(params: {
@@ -735,7 +716,7 @@ export declare function getPointDescription(params: {
735
716
 
736
717
  export declare class Hand {
737
718
  protected data: HandData;
738
- constructor(input: string | Block[], allowBackBlock?: boolean);
719
+ constructor(input: string | readonly Block[], allowBackBlock?: boolean);
739
720
  private init;
740
721
  get hands(): Tile[];
741
722
  toString(): string;
@@ -767,10 +748,10 @@ export declare interface HandData {
767
748
  }
768
749
 
769
750
  export declare interface HandsInput {
770
- front: Block[];
771
- right: Block[];
772
- opposite: Block[];
773
- left: Block[];
751
+ front: readonly Block[];
752
+ right: readonly Block[];
753
+ opposite: readonly Block[];
754
+ left: readonly Block[];
774
755
  }
775
756
 
776
757
  declare class Image_2 extends Mark {
@@ -784,8 +765,18 @@ export { Image_2 as Image }
784
765
 
785
766
  export declare class ImageHelper extends BaseHelper {
786
767
  readonly blockMargin: number;
787
- createBlockHandDiscard(block: Block): G;
788
- createBlockPonChiKan(block: Block): G;
768
+ createBlockDiscard(block: BlockOther): G;
769
+ createBlockHand(block: BlockHand): G;
770
+ createBlockChi(block: BlockChi): G;
771
+ createBlockPon(block: BlockChi): G;
772
+ createBlockShoKan(block: BlockShoKan): G;
773
+ createBlockDaiKan(block: BlockDaiKan): G;
774
+ createBlockAnKan(block: BlockAnKan): G;
775
+ createBlockDora(block: BlockOther, enableText?: boolean): G;
776
+ createBlockTsumo(block: BlockOther, enableText?: boolean): G;
777
+ protected createBlockSingleText(block: Block, text: string, enableText?: boolean): G;
778
+ protected createHorizontalBlock(tiles: readonly Tile[]): G;
779
+ protected findHorizontalIndex(block: Block): number;
789
780
  }
790
781
 
791
782
  export declare interface ImageHelperConfig {
@@ -801,7 +792,7 @@ export declare const INPUT_SEPARATOR = ",";
801
792
 
802
793
  export declare interface IRiver {
803
794
  discard(t: Tile, w: Wind): void;
804
- discards(w?: Wind): {
795
+ discards(w?: Wind): readonly {
805
796
  w: Wind;
806
797
  t: Tile;
807
798
  callMarker?: boolean;
@@ -812,7 +803,7 @@ export declare interface IRiver {
812
803
  callMarker?: boolean;
813
804
  };
814
805
  markCalled(): void;
815
- cannotContinue(): boolean;
806
+ isFourWindsAbort(): boolean;
816
807
  }
817
808
 
818
809
  export declare function is5Tile(t: Tile): boolean;
@@ -827,10 +818,10 @@ export declare interface IWall {
827
818
  canDraw: boolean;
828
819
  export(): WallProps;
829
820
  initialHands(): {
830
- [WIND.E]: string;
831
- [WIND.S]: string;
832
- [WIND.W]: string;
833
- [WIND.N]: string;
821
+ readonly [WIND.E]: string;
822
+ readonly [WIND.S]: string;
823
+ readonly [WIND.W]: string;
824
+ readonly [WIND.N]: string;
834
825
  };
835
826
  }
836
827
 
@@ -874,6 +865,12 @@ export declare const MyRect: typeof Rect;
874
865
 
875
866
  export declare const MySVG: typeof SVG;
876
867
 
868
+ export declare interface MySVGElement {
869
+ e: G;
870
+ width: number;
871
+ height: number;
872
+ }
873
+
877
874
  export declare const MyText: typeof Text_2;
878
875
 
879
876
  export declare const MyUse: typeof Use;
@@ -905,7 +902,7 @@ export declare class Observer extends BaseActor {
905
902
  export declare const OP: {
906
903
  readonly TSUMO: "t";
907
904
  readonly RON: "v";
908
- readonly DORA: "d";
905
+ readonly IMAGE_DORA: "d";
909
906
  readonly HORIZONTAL: "-";
910
907
  readonly RED: "r";
911
908
  readonly COLOR_GRAYSCALE: "^";
@@ -923,11 +920,17 @@ export declare const parse: (s: string) => {
923
920
 
924
921
  export declare class Parser {
925
922
  readonly input: string;
923
+ readonly options: {
924
+ enableImplicitTsumoBlock?: boolean;
925
+ };
926
926
  readonly maxInputLength = 600;
927
- constructor(input: string);
928
- parse(): (BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair)[];
927
+ constructor(input: string, options?: {
928
+ enableImplicitTsumoBlock?: boolean;
929
+ });
930
+ parse(): readonly Block[];
929
931
  tiles(): readonly Tile[];
930
932
  tileSeparators(): readonly (Tile | Separator)[];
933
+ private reconstruct;
931
934
  private makeBlocks;
932
935
  private validate;
933
936
  }
@@ -967,20 +970,22 @@ export declare const parseTableInput: (s: string) => {
967
970
  export declare class PlaceManager {
968
971
  private playerToWind;
969
972
  private windToPlayer;
970
- round: Round;
971
- sticks: {
972
- reach: number;
973
- dead: number;
974
- };
973
+ private _round;
974
+ private _sticks;
975
975
  constructor(initial: {
976
- [key: string]: Wind;
976
+ readonly [key: string]: Wind;
977
977
  }, params?: {
978
- round: Round;
979
- sticks: {
980
- reach: number;
981
- dead: number;
978
+ readonly round: Round;
979
+ readonly sticks: {
980
+ readonly reach: number;
981
+ readonly dead: number;
982
982
  };
983
983
  });
984
+ get sticks(): {
985
+ readonly reach: number;
986
+ readonly dead: number;
987
+ };
988
+ get round(): Round;
984
989
  private update;
985
990
  incrementDeadStick(): void;
986
991
  incrementReachStick(): void;
@@ -991,7 +996,7 @@ export declare class PlaceManager {
991
996
  wind(id: string): Wind;
992
997
  playerID(w: Wind): string;
993
998
  get playerMap(): {
994
- [id: string]: Wind;
999
+ readonly [id: string]: Wind;
995
1000
  };
996
1001
  }
997
1002
 
@@ -1006,8 +1011,8 @@ export declare class Player extends BaseActor {
1006
1011
  }
1007
1012
 
1008
1013
  export declare class PlayerEfficiency {
1009
- static analyzePlayerEfficiency(counter: Counter, analyses: TileAnalysis[]): PlayerTileAnalysis[];
1010
- static selectMinPriority(c: Counter, playerAnalyses: PlayerTileAnalysis[], doras: Tile[]): PlayerTileAnalysis;
1014
+ static analyzePlayerEfficiency(counter: Counter, analyses: readonly TileAnalysis[]): PlayerTileAnalysis[];
1015
+ static selectMinPriority(c: Counter, playerAnalyses: readonly PlayerTileAnalysis[], doras: Tile[]): PlayerTileAnalysis;
1011
1016
  private static calcPriority;
1012
1017
  }
1013
1018
 
@@ -1021,7 +1026,7 @@ export declare interface PlayerSession {
1021
1026
  export declare interface PlayerTileAnalysis {
1022
1027
  tile: Tile;
1023
1028
  sum: number;
1024
- effectiveTiles: {
1029
+ effectiveTiles: readonly {
1025
1030
  tile: Tile;
1026
1031
  count: number;
1027
1032
  }[];
@@ -1051,8 +1056,8 @@ export declare class PointCalculator {
1051
1056
  orig: BoardContext;
1052
1057
  };
1053
1058
  constructor(hand: Hand, params: BoardContext);
1054
- calc(...hands: readonly Block[][]): WinResult | false;
1055
- getWinningHands(hands: readonly Block[][]): WinningHand[];
1059
+ calc(...hands: readonly (readonly Block[])[]): WinResult | false;
1060
+ getWinningHands(hands: readonly (readonly Block[])[]): WinningHand[];
1056
1061
  private selectBestHand;
1057
1062
  private calculateScore;
1058
1063
  private hasYakuman;
@@ -1063,44 +1068,44 @@ export declare class PointCalculator {
1063
1068
  private calculateTsumoDeltas;
1064
1069
  private addStickPoints;
1065
1070
  private getBasePoints;
1066
- private minus;
1067
- dA1(h: readonly Block[]): Yaku[];
1068
- dB1(h: readonly Block[]): Yaku[];
1069
- dC1(h: readonly Block[]): Yaku[];
1070
- dD1(h: readonly Block[]): Yaku[];
1071
- dE1(h: readonly Block[]): Yaku[];
1072
- dF1(h: readonly Block[]): Yaku[];
1073
- dG1(h: readonly Block[]): Yaku[];
1074
- dH1(h: readonly Block[]): Yaku[];
1075
- dI1(h: readonly Block[]): Yaku[];
1076
- dJ1(h: readonly Block[]): Yaku[];
1077
- dK1(h: readonly Block[]): Yaku[];
1078
- dX1(h: readonly Block[]): Yaku[];
1079
- dA2(h: readonly Block[]): Yaku[];
1080
- dB2(h: readonly Block[]): Yaku[];
1081
- dC2(h: readonly Block[]): Yaku[];
1082
- dD2(h: readonly Block[]): Yaku[];
1083
- dE2(h: readonly Block[]): Yaku[];
1084
- dF2(h: readonly Block[]): Yaku[];
1085
- dG2(h: readonly Block[]): Yaku[];
1086
- dH2(h: readonly Block[]): Yaku[];
1087
- dI2(h: readonly Block[]): Yaku[];
1088
- dJ2(h: readonly Block[]): Yaku[];
1089
- dA3(h: readonly Block[]): Yaku[];
1090
- dB3(h: readonly Block[]): Yaku[];
1091
- dC3(h: readonly Block[]): Yaku[];
1092
- dA6(h: readonly Block[]): Yaku[];
1093
- dA13(h: readonly Block[]): Yaku[];
1094
- dB13(h: readonly Block[]): Yaku[];
1095
- dC13(h: readonly Block[]): Yaku[];
1096
- dD13(h: readonly Block[]): Yaku[];
1097
- dE13(h: readonly Block[]): Yaku[];
1098
- dF13(h: readonly Block[]): Yaku[];
1099
- dG13(h: readonly Block[]): Yaku[];
1100
- dH13(h: readonly Block[]): Yaku[];
1101
- dI13(h: readonly Block[]): Yaku[];
1102
- dJ13(h: readonly Block[]): Yaku[];
1103
- dK13(h: readonly Block[]): Yaku[];
1071
+ private getCalledPenalty;
1072
+ dA1(h: readonly Block[]): readonly Yaku[];
1073
+ dB1(h: readonly Block[]): readonly Yaku[];
1074
+ dC1(h: readonly Block[]): readonly Yaku[];
1075
+ dD1(h: readonly Block[]): readonly Yaku[];
1076
+ dE1(h: readonly Block[]): readonly Yaku[];
1077
+ dF1(h: readonly Block[]): readonly Yaku[];
1078
+ dG1(h: readonly Block[]): readonly Yaku[];
1079
+ dH1(h: readonly Block[]): readonly Yaku[];
1080
+ dI1(h: readonly Block[]): readonly Yaku[];
1081
+ dJ1(h: readonly Block[]): readonly Yaku[];
1082
+ dK1(h: readonly Block[]): readonly Yaku[];
1083
+ dX1(h: readonly Block[]): readonly Yaku[];
1084
+ dA2(h: readonly Block[]): readonly Yaku[];
1085
+ dB2(h: readonly Block[]): readonly Yaku[];
1086
+ dC2(h: readonly Block[]): readonly Yaku[];
1087
+ dD2(h: readonly Block[]): readonly Yaku[];
1088
+ dE2(h: readonly Block[]): readonly Yaku[];
1089
+ dF2(h: readonly Block[]): readonly Yaku[];
1090
+ dG2(h: readonly Block[]): readonly Yaku[];
1091
+ dH2(h: readonly Block[]): readonly Yaku[];
1092
+ dI2(h: readonly Block[]): readonly Yaku[];
1093
+ dJ2(h: readonly Block[]): readonly Yaku[];
1094
+ dA3(h: readonly Block[]): readonly Yaku[];
1095
+ dB3(h: readonly Block[]): readonly Yaku[];
1096
+ dC3(h: readonly Block[]): readonly Yaku[];
1097
+ dA6(h: readonly Block[]): readonly Yaku[];
1098
+ dA13(h: readonly Block[]): readonly Yaku[];
1099
+ dB13(h: readonly Block[]): readonly Yaku[];
1100
+ dC13(h: readonly Block[]): readonly Yaku[];
1101
+ dD13(h: readonly Block[]): readonly Yaku[];
1102
+ dE13(h: readonly Block[]): readonly Yaku[];
1103
+ dF13(h: readonly Block[]): readonly Yaku[];
1104
+ dG13(h: readonly Block[]): readonly Yaku[];
1105
+ dH13(h: readonly Block[]): readonly Yaku[];
1106
+ dI13(h: readonly Block[]): readonly Yaku[];
1107
+ dJ13(h: readonly Block[]): readonly Yaku[];
1108
+ dK13(h: readonly Block[]): readonly Yaku[];
1104
1109
  calcFu(h: readonly Block[]): number;
1105
1110
  }
1106
1111
 
@@ -1110,12 +1115,12 @@ export declare const prevWind: (w: Wind) => Wind;
1110
1115
 
1111
1116
  export declare function prioritizeDiscardedEvents(events: ChoiceAfterDiscardedEvent[]): {
1112
1117
  events: ChoiceAfterDiscardedEvent[];
1113
- type: boolean | keyof DiscardedChoice;
1118
+ type: boolean | keyof DiscardChoice;
1114
1119
  };
1115
1120
 
1116
1121
  export declare function prioritizeDrawnEvents(events: ChoiceAfterDrawnEvent[]): {
1117
1122
  events: ChoiceAfterDrawnEvent[];
1118
- type: boolean | keyof DrawnChoice;
1123
+ type: boolean | keyof DrawChoice;
1119
1124
  };
1120
1125
 
1121
1126
  export declare interface ReachAcceptedEvent {
@@ -1123,8 +1128,8 @@ export declare interface ReachAcceptedEvent {
1123
1128
  type: Extract<Event_2, "REACH_ACCEPTED">;
1124
1129
  wind: Wind;
1125
1130
  reacherInfo: {
1126
- wind: Wind;
1127
- tile: string;
1131
+ readonly wind: Wind;
1132
+ readonly tile: string;
1128
1133
  };
1129
1134
  }
1130
1135
 
@@ -1148,7 +1153,7 @@ export declare class Rect extends Mark {
1148
1153
 
1149
1154
  export declare class Replayer {
1150
1155
  index: number;
1151
- histories: GameHistory[];
1156
+ histories: RoundHistory[];
1152
1157
  constructor(v: string);
1153
1158
  next(): void;
1154
1159
  prev(): void;
@@ -1157,8 +1162,8 @@ export declare class Replayer {
1157
1162
  }
1158
1163
 
1159
1164
  export declare class RiskRank {
1160
- static selectTile(c: Counter, targetUsers: Wind[], tiles: Tile[]): Tile;
1161
- static rank(c: Counter, targetUsers: Wind[], t: Tile): number;
1165
+ static selectTile(c: Counter, targetUsers: readonly Wind[], tiles: readonly Tile[]): Tile;
1166
+ static rank(c: Counter, targetUsers: readonly Wind[], t: Tile): number;
1162
1167
  static rankZ(c: Counter, targetUser: Wind, t: Tile): number;
1163
1168
  static rankN(c: Counter, targetUser: Wind, t: Tile): 0 | 5 | 3 | 4 | 6 | 8 | 12;
1164
1169
  }
@@ -1178,7 +1183,7 @@ export declare class River {
1178
1183
  callMarker?: boolean;
1179
1184
  };
1180
1185
  markCalled(): void;
1181
- cannotContinue(): boolean;
1186
+ isFourWindsAbort(): boolean;
1182
1187
  }
1183
1188
 
1184
1189
  export declare interface RonEvent {
@@ -1188,8 +1193,8 @@ export declare interface RonEvent {
1188
1193
  wind: Wind;
1189
1194
  ret: SerializedWinResult;
1190
1195
  victimInfo: {
1191
- wind: Wind;
1192
- tile: string;
1196
+ readonly wind: Wind;
1197
+ readonly tile: string;
1193
1198
  };
1194
1199
  }
1195
1200
 
@@ -1233,6 +1238,26 @@ export declare const ROUND_MAP: {
1233
1238
  readonly "4z4": "北4局";
1234
1239
  };
1235
1240
 
1241
+ export declare interface RoundHistory {
1242
+ round: Round;
1243
+ scores: {
1244
+ [wind in string]: number;
1245
+ };
1246
+ players: {
1247
+ [id in string]: Wind;
1248
+ };
1249
+ sticks: {
1250
+ reach: number;
1251
+ dead: number;
1252
+ };
1253
+ wall: WallProps;
1254
+ choiceEvents: {
1255
+ [id: string]: PlayerEvent[];
1256
+ };
1257
+ }
1258
+
1259
+ export declare const roundWind: (r: Round) => Wind;
1260
+
1236
1261
  export declare interface ScoreBoardInput {
1237
1262
  doras: readonly Tile[];
1238
1263
  round: BoardRound;
@@ -1253,16 +1278,16 @@ export declare class ScoreManager {
1253
1278
  private reachValue;
1254
1279
  private m;
1255
1280
  constructor(initial: {
1256
- [key: string]: number;
1281
+ readonly [id: string]: number;
1257
1282
  });
1258
1283
  get summary(): {
1259
- [key: string]: number;
1284
+ readonly [id: string]: number;
1260
1285
  };
1261
1286
  reach(id: string): void;
1262
1287
  update(result: {
1263
- [w in Wind]: number;
1288
+ readonly [w in Wind]: number;
1264
1289
  }, windMap: {
1265
- [key: string]: Wind;
1290
+ readonly [id: string]: Wind;
1266
1291
  }): void;
1267
1292
  }
1268
1293
 
@@ -1533,7 +1558,7 @@ export declare const WIND_MAP: {
1533
1558
  };
1534
1559
 
1535
1560
  declare interface WinningHand {
1536
- hand: Block[];
1561
+ hand: readonly Block[];
1537
1562
  fu: number;
1538
1563
  yakus: readonly Yaku[];
1539
1564
  han: number;