@konoui/mjimage 0.0.45 → 0.0.47

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
@@ -86,20 +86,20 @@ export declare const BLOCK: {
86
86
  export declare abstract class Block {
87
87
  private readonly _tiles;
88
88
  private readonly _type;
89
- constructor(tiles: readonly Tile[], type: BLOCK);
89
+ constructor(tiles: readonly Tile[], type: BlockType);
90
90
  static deserialize(v: SerializedBlock): Block | BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair;
91
91
  serialize(): {
92
92
  tiles: string;
93
- type: BLOCK;
93
+ type: BlockType;
94
94
  };
95
95
  toJSON(): {
96
96
  tiles: string;
97
- type: BLOCK;
97
+ type: BlockType;
98
98
  };
99
- get type(): BLOCK;
99
+ get type(): BlockType;
100
100
  get tiles(): readonly Tile[];
101
101
  abstract toString(): string;
102
- is(type: BLOCK): boolean;
102
+ is(type: BlockType): boolean;
103
103
  isCalled(): boolean;
104
104
  clone(override?: {
105
105
  replace?: {
@@ -125,8 +125,10 @@ export declare class BlockCalculator {
125
125
  thirteenOrphans(): readonly Block[][];
126
126
  nineGates(): readonly Block[][];
127
127
  fourSetsOnePair(): readonly Block[][];
128
- private commonAll;
129
- private commonByType;
128
+ private patternAll;
129
+ private handleBack;
130
+ private handleZ;
131
+ private handleNumType;
130
132
  }
131
133
 
132
134
  export declare class BlockChi extends Block {
@@ -152,7 +154,7 @@ export declare class BlockIsolated extends Block {
152
154
  }
153
155
 
154
156
  export declare class BlockOther extends Block {
155
- constructor(tiles: readonly Tile[], type: BLOCK);
157
+ constructor(tiles: readonly Tile[], type: BlockType);
156
158
  toString(): string;
157
159
  }
158
160
 
@@ -185,6 +187,8 @@ export declare class BlockThree extends Block {
185
187
  toString(): string;
186
188
  }
187
189
 
190
+ declare type BlockType = (typeof BLOCK)[keyof typeof BLOCK];
191
+
188
192
  export declare interface BoardContext {
189
193
  doraMarkers: readonly Tile[];
190
194
  blindDoraMarkers?: readonly Tile[];
@@ -604,7 +608,7 @@ export declare class DoubleCalculator {
604
608
  orig: BoardContext;
605
609
  };
606
610
  constructor(hand: Hand, params: BoardContext);
607
- calc(hands: readonly Block[][]): WinResult | false;
611
+ calc(...hands: readonly Block[][]): WinResult | false;
608
612
  calcPatterns(hands: readonly Block[][]): {
609
613
  points: {
610
614
  name: string;
@@ -797,6 +801,7 @@ export declare class Efficiency {
797
801
  }): Candidate[];
798
802
  static candidateTiles(hand: Hand, options?: {
799
803
  fourSetsOnePair?: boolean;
804
+ typeFilter?: Type[];
800
805
  }): {
801
806
  shanten: number;
802
807
  candidates: Tile[];
@@ -853,7 +858,7 @@ export declare function forHand(options?: {
853
858
 
854
859
  export declare class Hand {
855
860
  protected data: HandData;
856
- constructor(input: string, allowBackBlock?: boolean);
861
+ constructor(input: string | Block[], allowBackBlock?: boolean);
857
862
  private init;
858
863
  get hands(): Tile[];
859
864
  toString(): string;
@@ -1302,7 +1307,7 @@ export declare class ShantenCalculator {
1302
1307
  sevenPairs(): number;
1303
1308
  thirteenOrphans(): number;
1304
1309
  fourSetsOnePair(): number;
1305
- private commonByType;
1310
+ private patternByNumType;
1306
1311
  private groupRemainingTiles;
1307
1312
  private calcCommon;
1308
1313
  }
@@ -1379,8 +1384,8 @@ readonly score: 25000;
1379
1384
  export declare class Tile {
1380
1385
  readonly t: Type;
1381
1386
  readonly n: number;
1382
- readonly ops: Operator[];
1383
- constructor(t: Type, n: number, ops?: Operator[]);
1387
+ readonly ops: readonly Operator[];
1388
+ constructor(t: Type, n: number, ops?: readonly Operator[]);
1384
1389
  static from(s: string): Tile;
1385
1390
  toString(): string;
1386
1391
  toJSON(): string;
package/dist/index.d.ts CHANGED
@@ -86,20 +86,20 @@ export declare const BLOCK: {
86
86
  export declare abstract class Block {
87
87
  private readonly _tiles;
88
88
  private readonly _type;
89
- constructor(tiles: readonly Tile[], type: BLOCK);
89
+ constructor(tiles: readonly Tile[], type: BlockType);
90
90
  static deserialize(v: SerializedBlock): Block | BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair;
91
91
  serialize(): {
92
92
  tiles: string;
93
- type: BLOCK;
93
+ type: BlockType;
94
94
  };
95
95
  toJSON(): {
96
96
  tiles: string;
97
- type: BLOCK;
97
+ type: BlockType;
98
98
  };
99
- get type(): BLOCK;
99
+ get type(): BlockType;
100
100
  get tiles(): readonly Tile[];
101
101
  abstract toString(): string;
102
- is(type: BLOCK): boolean;
102
+ is(type: BlockType): boolean;
103
103
  isCalled(): boolean;
104
104
  clone(override?: {
105
105
  replace?: {
@@ -125,8 +125,10 @@ export declare class BlockCalculator {
125
125
  thirteenOrphans(): readonly Block[][];
126
126
  nineGates(): readonly Block[][];
127
127
  fourSetsOnePair(): readonly Block[][];
128
- private commonAll;
129
- private commonByType;
128
+ private patternAll;
129
+ private handleBack;
130
+ private handleZ;
131
+ private handleNumType;
130
132
  }
131
133
 
132
134
  export declare class BlockChi extends Block {
@@ -152,7 +154,7 @@ export declare class BlockIsolated extends Block {
152
154
  }
153
155
 
154
156
  export declare class BlockOther extends Block {
155
- constructor(tiles: readonly Tile[], type: BLOCK);
157
+ constructor(tiles: readonly Tile[], type: BlockType);
156
158
  toString(): string;
157
159
  }
158
160
 
@@ -185,6 +187,8 @@ export declare class BlockThree extends Block {
185
187
  toString(): string;
186
188
  }
187
189
 
190
+ declare type BlockType = (typeof BLOCK)[keyof typeof BLOCK];
191
+
188
192
  export declare interface BoardContext {
189
193
  doraMarkers: readonly Tile[];
190
194
  blindDoraMarkers?: readonly Tile[];
@@ -604,7 +608,7 @@ export declare class DoubleCalculator {
604
608
  orig: BoardContext;
605
609
  };
606
610
  constructor(hand: Hand, params: BoardContext);
607
- calc(hands: readonly Block[][]): WinResult | false;
611
+ calc(...hands: readonly Block[][]): WinResult | false;
608
612
  calcPatterns(hands: readonly Block[][]): {
609
613
  points: {
610
614
  name: string;
@@ -797,6 +801,7 @@ export declare class Efficiency {
797
801
  }): Candidate[];
798
802
  static candidateTiles(hand: Hand, options?: {
799
803
  fourSetsOnePair?: boolean;
804
+ typeFilter?: Type[];
800
805
  }): {
801
806
  shanten: number;
802
807
  candidates: Tile[];
@@ -853,7 +858,7 @@ export declare function forHand(options?: {
853
858
 
854
859
  export declare class Hand {
855
860
  protected data: HandData;
856
- constructor(input: string, allowBackBlock?: boolean);
861
+ constructor(input: string | Block[], allowBackBlock?: boolean);
857
862
  private init;
858
863
  get hands(): Tile[];
859
864
  toString(): string;
@@ -1302,7 +1307,7 @@ export declare class ShantenCalculator {
1302
1307
  sevenPairs(): number;
1303
1308
  thirteenOrphans(): number;
1304
1309
  fourSetsOnePair(): number;
1305
- private commonByType;
1310
+ private patternByNumType;
1306
1311
  private groupRemainingTiles;
1307
1312
  private calcCommon;
1308
1313
  }
@@ -1379,8 +1384,8 @@ readonly score: 25000;
1379
1384
  export declare class Tile {
1380
1385
  readonly t: Type;
1381
1386
  readonly n: number;
1382
- readonly ops: Operator[];
1383
- constructor(t: Type, n: number, ops?: Operator[]);
1387
+ readonly ops: readonly Operator[];
1388
+ constructor(t: Type, n: number, ops?: readonly Operator[]);
1384
1389
  static from(s: string): Tile;
1385
1390
  toString(): string;
1386
1391
  toJSON(): string;