mahjong_engine 1.1.4 → 1.1.5
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/modules/tensuu/FuCalculator.d.ts +2 -1
- package/dist/modules/tensuu/FuCalculator.d.ts.map +1 -1
- package/dist/modules/tensuu/FuCalculator.js.map +1 -1
- package/dist/modules/tensuu/ScoreResolver.d.ts +3 -3
- package/dist/modules/tensuu/ScoreResolver.d.ts.map +1 -1
- package/dist/modules/tensuu/ScoreResolver.js +10 -10
- package/dist/modules/tensuu/ScoreResolver.js.map +1 -1
- package/dist/modules/tensuu/TensuuCalculator.d.ts +7 -2
- package/dist/modules/tensuu/TensuuCalculator.d.ts.map +1 -1
- package/dist/modules/tensuu/TensuuCalculator.js +8 -4
- package/dist/modules/tensuu/TensuuCalculator.js.map +1 -1
- package/dist/modules/yaku/NormalYakuChecker.d.ts +2 -1
- package/dist/modules/yaku/NormalYakuChecker.d.ts.map +1 -1
- package/dist/modules/yaku/NormalYakuChecker.js +10 -9
- package/dist/modules/yaku/NormalYakuChecker.js.map +1 -1
- package/dist/modules/yaku/YakuChecker.d.ts +2 -1
- package/dist/modules/yaku/YakuChecker.d.ts.map +1 -1
- package/dist/modules/yaku/YakuChecker.js +5 -4
- package/dist/modules/yaku/YakuChecker.js.map +1 -1
- package/dist/modules/yaku/YakuDetail.d.ts +7 -0
- package/dist/modules/yaku/YakuDetail.d.ts.map +1 -0
- package/dist/modules/yaku/YakuDetail.js +11 -0
- package/dist/modules/yaku/YakuDetail.js.map +1 -0
- package/dist/modules/yaku/YakuDetails.d.ts +13 -0
- package/dist/modules/yaku/YakuDetails.d.ts.map +1 -0
- package/dist/modules/yaku/YakuDetails.js +32 -0
- package/dist/modules/yaku/YakuDetails.js.map +1 -0
- package/dist/modules/yaku/YakumanChecker.d.ts +2 -1
- package/dist/modules/yaku/YakumanChecker.d.ts.map +1 -1
- package/dist/modules/yaku/YakumanChecker.js +8 -7
- package/dist/modules/yaku/YakumanChecker.js.map +1 -1
- package/dist/tests/hanName.test.js +2 -1
- package/dist/tests/hanName.test.js.map +1 -1
- package/dist/tests/tensuu/hanName.d.ts.map +1 -1
- package/dist/tests/tensuu/hanName.js +33 -0
- package/dist/tests/tensuu/hanName.js.map +1 -1
- package/dist/tests/tensuu/tensuuNum.d.ts.map +1 -1
- package/dist/tests/tensuu/tensuuNum.js +20 -0
- package/dist/tests/tensuu/tensuuNum.js.map +1 -1
- package/dist/tests/tensuuFromNum.test.js +1 -1
- package/dist/tests/tensuuFromNum.test.js.map +1 -1
- package/dist/tests/testConsts.d.ts +2 -0
- package/dist/tests/testConsts.d.ts.map +1 -1
- package/dist/tests/yaku.test.js +3 -3
- package/dist/tests/yaku.test.js.map +1 -1
- package/modules/tensuu/FuCalculator.ts +3 -2
- package/modules/tensuu/ScoreResolver.ts +13 -13
- package/modules/tensuu/TensuuCalculator.ts +10 -5
- package/modules/yaku/NormalYakuChecker.ts +11 -10
- package/modules/yaku/YakuChecker.ts +6 -5
- package/modules/yaku/YakuDetail.ts +11 -0
- package/modules/yaku/YakuDetails.ts +42 -0
- package/modules/yaku/YakumanChecker.ts +9 -7
- package/package.json +1 -1
- package/tests/hanName.test.ts +2 -1
- package/tests/tensuu/hanName.ts +33 -0
- package/tests/tensuu/tensuuNum.ts +20 -0
- package/tests/tensuuFromNum.test.ts +1 -1
- package/tests/testConsts.ts +3 -1
- package/tests/yaku.test.ts +7 -5
package/tests/tensuu/hanName.ts
CHANGED
|
@@ -5,114 +5,147 @@ export const casesHanName: hanNameCase[] = [
|
|
|
5
5
|
name: "hon1",
|
|
6
6
|
desc: "なし",
|
|
7
7
|
han: 1,
|
|
8
|
+
isYakuman: false,
|
|
8
9
|
expected: ""
|
|
9
10
|
},
|
|
10
11
|
{
|
|
11
12
|
name: "hon2",
|
|
12
13
|
desc: "なし",
|
|
13
14
|
han: 2,
|
|
15
|
+
isYakuman: false,
|
|
14
16
|
expected: ""
|
|
15
17
|
},
|
|
16
18
|
{
|
|
17
19
|
name: "hon3",
|
|
18
20
|
desc: "なし",
|
|
19
21
|
han: 3,
|
|
22
|
+
isYakuman: false,
|
|
20
23
|
expected: ""
|
|
21
24
|
},
|
|
22
25
|
{
|
|
23
26
|
name: "hon4",
|
|
24
27
|
desc: "なし",
|
|
25
28
|
han: 4,
|
|
29
|
+
isYakuman: false,
|
|
26
30
|
expected: ""
|
|
27
31
|
},
|
|
28
32
|
{
|
|
29
33
|
name: "hon5",
|
|
30
34
|
desc: "満貫",
|
|
31
35
|
han: 5,
|
|
36
|
+
isYakuman: false,
|
|
32
37
|
expected: "満貫"
|
|
33
38
|
},
|
|
34
39
|
{
|
|
35
40
|
name: "hon6",
|
|
36
41
|
desc: "跳満",
|
|
37
42
|
han: 6,
|
|
43
|
+
isYakuman: false,
|
|
38
44
|
expected: "跳満"
|
|
39
45
|
},
|
|
40
46
|
{
|
|
41
47
|
name: "hon7",
|
|
42
48
|
desc: "跳満",
|
|
43
49
|
han: 7,
|
|
50
|
+
isYakuman: false,
|
|
44
51
|
expected: "跳満"
|
|
45
52
|
},
|
|
46
53
|
{
|
|
47
54
|
name: "hon8",
|
|
48
55
|
desc: "跳満",
|
|
49
56
|
han: 8,
|
|
57
|
+
isYakuman: false,
|
|
50
58
|
expected: "倍満"
|
|
51
59
|
},
|
|
52
60
|
{
|
|
53
61
|
name: "hon9",
|
|
54
62
|
desc: "倍満",
|
|
55
63
|
han: 9,
|
|
64
|
+
isYakuman: false,
|
|
56
65
|
expected: "倍満"
|
|
57
66
|
},
|
|
58
67
|
{
|
|
59
68
|
name: "hon10",
|
|
60
69
|
desc: "倍満",
|
|
61
70
|
han: 10,
|
|
71
|
+
isYakuman: false,
|
|
62
72
|
expected: "倍満"
|
|
63
73
|
},
|
|
64
74
|
{
|
|
65
75
|
name: "hon11",
|
|
66
76
|
desc: "三倍満",
|
|
67
77
|
han: 11,
|
|
78
|
+
isYakuman: false,
|
|
68
79
|
expected: "三倍満"
|
|
69
80
|
},
|
|
70
81
|
{
|
|
71
82
|
name: "hon12",
|
|
72
83
|
desc: "三倍満",
|
|
73
84
|
han: 12,
|
|
85
|
+
isYakuman: false,
|
|
74
86
|
expected: "三倍満"
|
|
75
87
|
},
|
|
76
88
|
{
|
|
77
89
|
name: "hon13",
|
|
78
90
|
desc: "役満以上",
|
|
79
91
|
han: 13,
|
|
92
|
+
isYakuman: false,
|
|
93
|
+
expected: "数え役満"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "hon13",
|
|
97
|
+
desc: "役満以上",
|
|
98
|
+
han: 13,
|
|
99
|
+
isYakuman: true,
|
|
80
100
|
expected: "役満"
|
|
81
101
|
},
|
|
82
102
|
{
|
|
83
103
|
name: "hon26",
|
|
84
104
|
desc: "役満以上",
|
|
85
105
|
han: 26,
|
|
106
|
+
isYakuman: false,
|
|
107
|
+
expected: "数え役満"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "hon26",
|
|
111
|
+
desc: "役満以上",
|
|
112
|
+
han: 26,
|
|
113
|
+
isYakuman: true,
|
|
86
114
|
expected: "二倍役満"
|
|
87
115
|
},
|
|
88
116
|
{
|
|
89
117
|
name: "hon39",
|
|
90
118
|
desc: "役満以上",
|
|
91
119
|
han: 39,
|
|
120
|
+
isYakuman: true,
|
|
92
121
|
expected: "三倍役満"
|
|
93
122
|
},
|
|
94
123
|
{
|
|
95
124
|
name: "hon52",
|
|
96
125
|
desc: "役満以上",
|
|
97
126
|
han: 52,
|
|
127
|
+
isYakuman: true,
|
|
98
128
|
expected: "四倍役満"
|
|
99
129
|
},
|
|
100
130
|
{
|
|
101
131
|
name: "hon65",
|
|
102
132
|
desc: "役満以上",
|
|
103
133
|
han: 65,
|
|
134
|
+
isYakuman: true,
|
|
104
135
|
expected: "五倍役満"
|
|
105
136
|
},
|
|
106
137
|
{
|
|
107
138
|
name: "hon78",
|
|
108
139
|
desc: "役満以上",
|
|
109
140
|
han: 78,
|
|
141
|
+
isYakuman: true,
|
|
110
142
|
expected: "六倍役満"
|
|
111
143
|
},
|
|
112
144
|
{
|
|
113
145
|
name: "hon79",
|
|
114
146
|
desc: "役満以上",
|
|
115
147
|
han: 79,
|
|
148
|
+
isYakuman: true,
|
|
116
149
|
expected: "六倍役満"
|
|
117
150
|
},
|
|
118
151
|
]
|
|
@@ -282,11 +282,27 @@ export const caseNum: TensuuNumCase[] = [
|
|
|
282
282
|
fusuu: 20,
|
|
283
283
|
expected: new TensuuResult(8000, 48000, 32000, 16000, {oya:16000, ko:8000})
|
|
284
284
|
},
|
|
285
|
+
{
|
|
286
|
+
name: "hon13",
|
|
287
|
+
desc: "13翻",
|
|
288
|
+
honsuu: 13,
|
|
289
|
+
fusuu: 20,
|
|
290
|
+
isYakuman: true,
|
|
291
|
+
expected: new TensuuResult(8000, 48000, 32000, 16000, {oya:16000, ko:8000})
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: "hon26",
|
|
295
|
+
desc: "26翻",
|
|
296
|
+
honsuu: 26,
|
|
297
|
+
fusuu: 20,
|
|
298
|
+
expected: new TensuuResult(8000, 48000, 32000, 16000, {oya:16000, ko:8000})
|
|
299
|
+
},
|
|
285
300
|
{
|
|
286
301
|
name: "hon26",
|
|
287
302
|
desc: "26翻",
|
|
288
303
|
honsuu: 26,
|
|
289
304
|
fusuu: 20,
|
|
305
|
+
isYakuman: true,
|
|
290
306
|
expected: new TensuuResult(16000, 96000, 64000, 32000, {oya:32000, ko:16000})
|
|
291
307
|
},
|
|
292
308
|
{
|
|
@@ -294,6 +310,7 @@ export const caseNum: TensuuNumCase[] = [
|
|
|
294
310
|
desc: "39翻",
|
|
295
311
|
honsuu: 39,
|
|
296
312
|
fusuu: 20,
|
|
313
|
+
isYakuman: true,
|
|
297
314
|
expected: new TensuuResult(24000, 144000, 96000, 48000, {oya:48000, ko:24000})
|
|
298
315
|
},
|
|
299
316
|
{
|
|
@@ -301,6 +318,7 @@ export const caseNum: TensuuNumCase[] = [
|
|
|
301
318
|
desc: "52翻",
|
|
302
319
|
honsuu: 52,
|
|
303
320
|
fusuu: 20,
|
|
321
|
+
isYakuman: true,
|
|
304
322
|
expected: new TensuuResult(32000, 192000, 128000, 64000, {oya:64000, ko:32000})
|
|
305
323
|
},
|
|
306
324
|
{
|
|
@@ -308,6 +326,7 @@ export const caseNum: TensuuNumCase[] = [
|
|
|
308
326
|
desc: "65翻",
|
|
309
327
|
honsuu: 65,
|
|
310
328
|
fusuu: 20,
|
|
329
|
+
isYakuman: true,
|
|
311
330
|
expected: new TensuuResult(40000, 240000, 160000, 80000, {oya:80000, ko:40000})
|
|
312
331
|
},
|
|
313
332
|
{
|
|
@@ -315,6 +334,7 @@ export const caseNum: TensuuNumCase[] = [
|
|
|
315
334
|
desc: "78翻",
|
|
316
335
|
honsuu: 78,
|
|
317
336
|
fusuu: 20,
|
|
337
|
+
isYakuman: true,
|
|
318
338
|
expected: new TensuuResult(48000, 288000, 192000, 96000, {oya:96000, ko:48000})
|
|
319
339
|
},
|
|
320
340
|
];
|
|
@@ -8,7 +8,7 @@ caseNum.forEach(casenum => testcases.push(casenum));
|
|
|
8
8
|
testcases.forEach(testcase => {
|
|
9
9
|
describe(testcase.desc, () => {
|
|
10
10
|
test(testcase.name, () => {
|
|
11
|
-
const expected = TensuuCalculator.calcTensuu(testcase.honsuu, testcase.fusuu);
|
|
11
|
+
const expected = TensuuCalculator.calcTensuu(testcase.honsuu, testcase.fusuu, testcase.isYakuman ?? false);
|
|
12
12
|
expect(testcase.expected).toEqual(expected);
|
|
13
13
|
});
|
|
14
14
|
});
|
package/tests/testConsts.ts
CHANGED
|
@@ -37,7 +37,8 @@ export type TensuuNumCase = {
|
|
|
37
37
|
name: string,
|
|
38
38
|
desc: string,
|
|
39
39
|
honsuu: number,
|
|
40
|
-
fusuu: number
|
|
40
|
+
fusuu: number,
|
|
41
|
+
isYakuman?: boolean,
|
|
41
42
|
expected: TensuuResult;
|
|
42
43
|
}
|
|
43
44
|
|
|
@@ -45,6 +46,7 @@ export type hanNameCase = {
|
|
|
45
46
|
name: string,
|
|
46
47
|
desc: string,
|
|
47
48
|
han: number,
|
|
49
|
+
isYakuman: boolean,
|
|
48
50
|
expected: string
|
|
49
51
|
}
|
|
50
52
|
|
package/tests/yaku.test.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { casesNormal } from './yaku/normal';
|
|
|
4
4
|
import { TehaiCase } from './testConsts';
|
|
5
5
|
import { YakuContext } from '../modules/yaku/YakuContext';
|
|
6
6
|
import { TehaiCaseRunner } from './tehaiCaseRunner';
|
|
7
|
+
import { YakuDetails } from "../modules/yaku/YakuDetails";
|
|
8
|
+
import { BlockHaisList } from "../modules";
|
|
7
9
|
|
|
8
10
|
type yakuMaps = Map<number, Map<string, number>>;
|
|
9
11
|
|
|
@@ -14,13 +16,13 @@ casesNormal.forEach(casenormal => testcases.push(casenormal));
|
|
|
14
16
|
testcases.forEach(testcase => {
|
|
15
17
|
describe(testcase.desc, () => {
|
|
16
18
|
test(testcase.name, () => {
|
|
17
|
-
const yakuMaps: yakuMaps = new Map
|
|
19
|
+
const yakuMaps: yakuMaps = new Map();
|
|
18
20
|
const runner: TehaiCaseRunner<yakuMaps> = new TehaiCaseRunner(testcase);
|
|
19
|
-
const blocks = runner.blocks;
|
|
21
|
+
const blocks:BlockHaisList[] = runner.blocks;
|
|
20
22
|
blocks.forEach((block, index) => {
|
|
21
|
-
const context = new YakuContext(runner.hand, runner.ctx, block);
|
|
22
|
-
const
|
|
23
|
-
if(
|
|
23
|
+
const context: YakuContext = new YakuContext(runner.hand, runner.ctx, block);
|
|
24
|
+
const details: YakuDetails = new YakuChecker(context).check();
|
|
25
|
+
if(details.length > 0) yakuMaps.set(index, details.toMap());
|
|
24
26
|
});
|
|
25
27
|
expect(yakuMaps).toEqual(testcase.expected);
|
|
26
28
|
});
|