|
@@ -1,255 +1,257 @@
|
1
|
|
-import { descartes, combination } from './math'
|
2
|
|
-
|
3
|
|
-// 模拟比赛得分
|
4
|
|
-const matches = [
|
5
|
|
- [1, 0], [2, 0], [2, 1], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2], [99, 0],
|
6
|
|
- [0, 0], [1, 1], [2, 2], [3, 3], [99, 99],
|
7
|
|
- [0, 1], [0, 2], [1, 2], [0, 3], [1, 3], [2, 3], [0, 4], [1, 4], [2, 4], [0, 5], [1, 5], [2, 5], [0, 99],
|
8
|
|
-]
|
9
|
|
-
|
10
|
|
-const playWayFunc = {
|
11
|
|
- 'ft-wdl': computeWDL,
|
12
|
|
- 'ft-wdls': computeWDLS,
|
13
|
|
- 'ft-score': computeScore,
|
14
|
|
- 'ft-points': computePoints,
|
15
|
|
- 'ft-double': computeDouble,
|
16
|
|
-}
|
17
|
|
-
|
18
|
|
-/**
|
19
|
|
- * 依据投注列表,生成所有可能的排列组合
|
20
|
|
- * @param {*} noteList 投注列表
|
21
|
|
- * @param {*} passDict 过关字典
|
22
|
|
- */
|
23
|
|
-function getAllParts(noteList, passDict) {
|
24
|
|
- // 转换过关字典
|
25
|
|
- const passArr = [
|
26
|
|
- passDict.level1,
|
27
|
|
- passDict.level2,
|
28
|
|
- passDict.level3,
|
29
|
|
- passDict.level4,
|
30
|
|
- passDict.level5,
|
31
|
|
- passDict.level6,
|
32
|
|
- passDict.level7,
|
33
|
|
- passDict.level8,
|
34
|
|
- ]
|
35
|
|
-
|
36
|
|
- // 总投注场次, 比如选了 4 场
|
37
|
|
- const noteLength = noteList.length
|
38
|
|
-
|
39
|
|
- // 从投注场次中, 选择过关场次组合
|
40
|
|
- // 比如投注4场比赛, 过关方式为3串4
|
41
|
|
- // 这个步骤确定了场次的组合方式
|
42
|
|
- const noCompact = combination(noteList, passDict.unitNum)
|
43
|
|
-
|
44
|
|
- // 场次组合完成, 下面需要算出每种场次的 3串4 的方式
|
45
|
|
- // 比如场次 A,B,C 或者 A,B,D 三场, 每种如何组成 3 串 4
|
46
|
|
- // 这个步骤确定了每个场次组合方式的投注组合方式
|
47
|
|
- const all = noCompact.map(list => {
|
48
|
|
- const grps = passArr.forEach((pass, inx) => {
|
49
|
|
- if (!pass) return undefined
|
50
|
|
-
|
51
|
|
- // level1 的 inx 是 0, 但是实际上场次要求是 1
|
52
|
|
- return combination(list, inx + 1)
|
53
|
|
- }).filter(Boolean)
|
54
|
|
-
|
55
|
|
- // 所有的过关, 笛卡尔积组合
|
56
|
|
- return descartes(...grps)
|
57
|
|
- })
|
58
|
|
-
|
59
|
|
- // 把所有场次的组合方式展平
|
60
|
|
- return all.reduce((acc, list) => ([...acc, ...list]),[])
|
61
|
|
-}
|
62
|
|
-
|
63
|
|
-// 遍历模拟比赛获取最大, 最小奖金
|
64
|
|
-// rq 让球数
|
65
|
|
-function getPrice(allParts, rq) {
|
66
|
|
- let minPrice = undefined
|
67
|
|
- let maxPrice = undefined
|
68
|
|
-
|
69
|
|
- // 遍历模拟比赛的各种可能
|
70
|
|
- matches.forEach(match => {
|
71
|
|
- const [min, max] = getMinAndMax(allParts, match, rq)
|
72
|
|
- if (min < minPrice || minPrice === undefined) {
|
73
|
|
- minPrice = min
|
74
|
|
- }
|
75
|
|
-
|
76
|
|
- if (max > maxPrice || maxPrice === undefined) {
|
77
|
|
- maxPrice = max
|
78
|
|
- }
|
79
|
|
- })
|
80
|
|
-
|
81
|
|
- return [minPrice, maxPrice]
|
82
|
|
-}
|
83
|
|
-
|
84
|
|
-function getMinAndMax(allParts, match, rq) {
|
85
|
|
- let minPrice = 0
|
86
|
|
- let maxPrice = 0
|
87
|
|
-
|
88
|
|
- // 所有组合
|
89
|
|
- allParts.forEach(parts => {
|
90
|
|
- // 每种组合 比如 3串4 是 3个2串1, 1个3串1
|
91
|
|
- const price = parts.map(part => {
|
92
|
|
- // 场次组合 比如 2串1
|
93
|
|
- return part.map(grp => {
|
94
|
|
- const { wayCode } = grp.rules
|
95
|
|
- const fn = playWayFunc[wayCode]
|
96
|
|
- return fn(grp, match, rq)
|
97
|
|
- }).filter(Boolean).reduce((acc, x) => acc * x, 1)
|
98
|
|
-
|
99
|
|
- }).reduce((acc, x) => acc + x, 0)
|
100
|
|
-
|
101
|
|
- if (minPrice === 0 || minPrice > price) {
|
102
|
|
- minPrice = price
|
103
|
|
- }
|
104
|
|
-
|
105
|
|
- maxPrice += maxPrice
|
106
|
|
- })
|
107
|
|
-
|
108
|
|
- return [minPrice, maxPrice]
|
109
|
|
-}
|
110
|
|
-
|
111
|
|
-// 胜平负
|
112
|
|
-function computeWDL(part, match, rq) {
|
113
|
|
- const [x, y] = match
|
114
|
|
- const {ruleCode, odds} = part.rules
|
115
|
|
-
|
116
|
|
- switch (ruleCode) {
|
117
|
|
- case 'ft-win':
|
118
|
|
- return x > y ? odds : 0
|
119
|
|
- case 'ft-dead':
|
120
|
|
- return x == y ? odds : 0
|
121
|
|
- default:
|
122
|
|
- return x < y ? odds : 0
|
123
|
|
- }
|
124
|
|
-}
|
125
|
|
-
|
126
|
|
-// 让球胜平负
|
127
|
|
-function computeWDLS(part, match, rq) {
|
128
|
|
- const [x, y] = match
|
129
|
|
- const {ruleCode, odds} = part.rules
|
130
|
|
-
|
131
|
|
- switch (ruleCode) {
|
132
|
|
- case 'ft-sp-win':
|
133
|
|
- return x + rq > y ? odds : 0
|
134
|
|
- case 'ft-sp-dead':
|
135
|
|
- return x + rq == y ? odds : 0
|
136
|
|
- default:
|
137
|
|
- return x + rq < y ? odds : 0
|
138
|
|
- }
|
139
|
|
-}
|
140
|
|
-
|
141
|
|
-// 比分
|
142
|
|
-function computeScore(part, match, rq) {
|
143
|
|
- const [x, y] = match
|
144
|
|
- const {ruleCode, odds} = part.rules
|
145
|
|
-
|
146
|
|
- switch (ruleCode) {
|
147
|
|
- case 'ft-w10':
|
148
|
|
- return x == 1 && y == 0 ? odds : 0
|
149
|
|
- case 'ft-w20':
|
150
|
|
- return x == 2 && y == 0 ? odds : 0
|
151
|
|
- case 'ft-w21':
|
152
|
|
- return x == 2 && y == 1 ? odds : 0
|
153
|
|
- case 'ft-w30':
|
154
|
|
- return x == 3 && y == 0 ? odds : 0
|
155
|
|
- case 'ft-w31':
|
156
|
|
- return x == 3 && y == 1 ? odds : 0
|
157
|
|
- case 'ft-w32':
|
158
|
|
- return x == 3 && y == 2 ? odds : 0
|
159
|
|
- case 'ft-w40':
|
160
|
|
- return x == 4 && y == 0 ? odds : 0
|
161
|
|
- case 'ft-w41':
|
162
|
|
- return x == 4 && y == 1 ? odds : 0
|
163
|
|
- case 'ft-w42':
|
164
|
|
- return x == 4 && y == 2 ? odds : 0
|
165
|
|
- case 'ft-w50':
|
166
|
|
- return x == 5 && y == 0 ? odds : 0
|
167
|
|
- case 'ft-w51':
|
168
|
|
- return x == 5 && y == 1 ? odds : 0
|
169
|
|
- case 'ft-w52':
|
170
|
|
- return x == 5 && y == 2 ? odds : 0
|
171
|
|
- case 'ft-w99':
|
172
|
|
- return x > 5 && x > y ? odds : 0
|
173
|
|
- case 'ft-d00':
|
174
|
|
- return x == 0 && x == y ? odds : 0
|
175
|
|
- case 'ft-d11':
|
176
|
|
- return x == 1 && x == y ? odds : 0
|
177
|
|
- case 'ft-d22':
|
178
|
|
- return x == 2 && x == y ? odds : 0
|
179
|
|
- case 'ft-d33':
|
180
|
|
- return x == 3 && x == y ? odds : 0
|
181
|
|
- case 'ft-d99':
|
182
|
|
- return x > 5 && x == y ? odds : 0
|
183
|
|
- case 'ft-l01':
|
184
|
|
- return x == 0 && y == 1 ? odds : 0
|
185
|
|
- case 'ft-l02':
|
186
|
|
- return x == 0 && y == 2 ? odds : 0
|
187
|
|
- case 'ft-l12':
|
188
|
|
- return x == 1 && y == 2 ? odds : 0
|
189
|
|
- case 'ft-l03':
|
190
|
|
- return x == 0 && y == 3 ? odds : 0
|
191
|
|
- case 'ft-l13':
|
192
|
|
- return x == 1 && y == 3 ? odds : 0
|
193
|
|
- case 'ft-l23':
|
194
|
|
- return x == 2 && y == 3 ? odds : 0
|
195
|
|
- case 'ft-l04':
|
196
|
|
- return x == 0 && y == 4 ? odds : 0
|
197
|
|
- case 'ft-l14':
|
198
|
|
- return x == 1 && y == 4 ? odds : 0
|
199
|
|
- case 'ft-l24':
|
200
|
|
- return x == 2 && y == 4 ? odds : 0
|
201
|
|
- case 'ft-l05':
|
202
|
|
- return x == 0 && y == 5 ? odds : 0
|
203
|
|
- case 'ft-l15':
|
204
|
|
- return x == 1 && y == 5 ? odds : 0
|
205
|
|
- case 'ft-l25':
|
206
|
|
- return x == 2 && y == 5 ? odds : 0
|
207
|
|
- default:
|
208
|
|
- return x < y && y > 5 ? odds : 0
|
209
|
|
- }
|
210
|
|
-}
|
211
|
|
-
|
212
|
|
-// 进球数
|
213
|
|
-function computePoints(part, match, rq) {
|
214
|
|
- const [x, y] = match
|
215
|
|
- const {ruleCode, odds} = part.rules
|
216
|
|
-
|
217
|
|
- switch (ruleCode) {
|
218
|
|
- case 'ft-p0':
|
219
|
|
- return x == 0 && y == 0 ? odds : 0
|
220
|
|
- case 'ft-p1':
|
221
|
|
- return x + y == 1 ? odds : 0
|
222
|
|
- case 'ft-p2':
|
223
|
|
- return x + y == 2 ? odds : 0
|
224
|
|
- case 'ft-p3':
|
225
|
|
- return x + y == 3 ? odds : 0
|
226
|
|
- case 'ft-p4':
|
227
|
|
- return x + y == 4 ? odds : 0
|
228
|
|
- case 'ft-p5':
|
229
|
|
- return x + y == 5 ? odds : 0
|
230
|
|
- case 'ft-p6':
|
231
|
|
- return x + y == 6 ? odds : 0
|
232
|
|
- default:
|
233
|
|
- return x + y > 6 ? odds : 0
|
234
|
|
- }
|
235
|
|
-}
|
236
|
|
-
|
237
|
|
-// 半全场
|
238
|
|
-function computeDouble(part, match, rq) {
|
239
|
|
- const [x, y] = match
|
240
|
|
- const {ruleCode, odds} = part.rules
|
241
|
|
-
|
242
|
|
- switch (ruleCode) {
|
243
|
|
- case 'ft-ww':
|
244
|
|
- case 'ft-dw':
|
245
|
|
- case 'ft-lw':
|
246
|
|
- return x > y ? odds : 0
|
247
|
|
- case 'ft-wd':
|
248
|
|
- case 'ft-dd':
|
249
|
|
- case 'ft-ld':
|
250
|
|
- return x == y ? odds : 0
|
251
|
|
- default:
|
252
|
|
- return x < y ? odds : 0
|
253
|
|
- }
|
254
|
|
-}
|
255
|
|
-
|
|
1
|
+/* eslint-disable */
|
|
2
|
+import { descartes, combination } from './math'
|
|
3
|
+
|
|
4
|
+// 模拟比赛得分
|
|
5
|
+const matches = [
|
|
6
|
+ [1, 0], [2, 0], [2, 1], [3, 0], [3, 1], [3, 2], [4, 0], [4, 1], [4, 2], [5, 0], [5, 1], [5, 2], [99, 0],
|
|
7
|
+ [0, 0], [1, 1], [2, 2], [3, 3], [99, 99],
|
|
8
|
+ [0, 1], [0, 2], [1, 2], [0, 3], [1, 3], [2, 3], [0, 4], [1, 4], [2, 4], [0, 5], [1, 5], [2, 5], [0, 99],
|
|
9
|
+]
|
|
10
|
+
|
|
11
|
+const playWayFunc = {
|
|
12
|
+ 'ft-wdl': computeWDL,
|
|
13
|
+ 'ft-wdls': computeWDLS,
|
|
14
|
+ 'ft-score': computeScore,
|
|
15
|
+ 'ft-points': computePoints,
|
|
16
|
+ 'ft-double': computeDouble,
|
|
17
|
+}
|
|
18
|
+
|
|
19
|
+/**
|
|
20
|
+ * 依据投注列表,生成所有可能的排列组合
|
|
21
|
+ * @param {*} noteList 投注列表
|
|
22
|
+ * @param {*} passDict 过关字典
|
|
23
|
+ */
|
|
24
|
+function GetAllParts (noteList, passDict) {
|
|
25
|
+ // 转换过关字典
|
|
26
|
+ const passArr = [
|
|
27
|
+ passDict.level1,
|
|
28
|
+ passDict.level2,
|
|
29
|
+ passDict.level3,
|
|
30
|
+ passDict.level4,
|
|
31
|
+ passDict.level5,
|
|
32
|
+ passDict.level6,
|
|
33
|
+ passDict.level7,
|
|
34
|
+ passDict.level8,
|
|
35
|
+ ]
|
|
36
|
+
|
|
37
|
+ // 总投注场次, 比如选了 4 场
|
|
38
|
+ const noteLength = noteList.length
|
|
39
|
+
|
|
40
|
+ // 从投注场次中, 选择过关场次组合
|
|
41
|
+ // 比如投注4场比赛, 过关方式为3串4
|
|
42
|
+ // 这个步骤确定了场次的组合方式
|
|
43
|
+ const noCompact = combination(noteList, passDict.unitNum)
|
|
44
|
+
|
|
45
|
+ // 场次组合完成, 下面需要算出每种场次的 3串4 的方式
|
|
46
|
+ // 比如场次 A,B,C 或者 A,B,D 三场, 每种如何组成 3 串 4
|
|
47
|
+ // 这个步骤确定了每个场次组合方式的投注组合方式
|
|
48
|
+ const all = noCompact.map(list => {
|
|
49
|
+ const grps = passArr.map((pass, inx) => {
|
|
50
|
+ if (!pass) return undefined
|
|
51
|
+
|
|
52
|
+ // level1 的 inx 是 0, 但是实际上场次要求是 1
|
|
53
|
+ return combination(list, inx + 1)
|
|
54
|
+ }).filter(Boolean)
|
|
55
|
+
|
|
56
|
+ // 所有的过关, 笛卡尔积组合
|
|
57
|
+ return descartes(...grps)
|
|
58
|
+ })
|
|
59
|
+
|
|
60
|
+ // 把所有场次的组合方式展平
|
|
61
|
+ return all.reduce((acc, list) => ([...acc, ...list]), [])
|
|
62
|
+}
|
|
63
|
+
|
|
64
|
+// 遍历模拟比赛获取最大, 最小奖金
|
|
65
|
+// rq 让球数
|
|
66
|
+function GetPrice (allParts, rq) {
|
|
67
|
+ let minPrice = undefined
|
|
68
|
+ let maxPrice = undefined
|
|
69
|
+
|
|
70
|
+ // 遍历模拟比赛的各种可能
|
|
71
|
+ matches.forEach(match => {
|
|
72
|
+ const [min, max] = GetMinAndMax(allParts, match, rq)
|
|
73
|
+ if (min < minPrice || minPrice === undefined) {
|
|
74
|
+ minPrice = min
|
|
75
|
+ }
|
|
76
|
+
|
|
77
|
+ if (max > maxPrice || maxPrice === undefined) {
|
|
78
|
+ maxPrice = max
|
|
79
|
+ }
|
|
80
|
+ })
|
|
81
|
+
|
|
82
|
+ return [minPrice, maxPrice]
|
|
83
|
+}
|
|
84
|
+
|
|
85
|
+function GetMinAndMax (allParts, match, rq) {
|
|
86
|
+ let minPrice = 0
|
|
87
|
+ let maxPrice = 0
|
|
88
|
+
|
|
89
|
+ // 所有组合
|
|
90
|
+ allParts.forEach(parts => {
|
|
91
|
+ // 每种组合 比如 3串4 是 3个2串1, 1个3串1
|
|
92
|
+ const price = parts.map(part => {
|
|
93
|
+ // 场次组合 比如 2串1
|
|
94
|
+ return part.map(grp => {
|
|
95
|
+ const { wayCode } = grp.rules
|
|
96
|
+ const fn = playWayFunc[wayCode]
|
|
97
|
+ return fn(grp, match, rq)
|
|
98
|
+ }).filter(Boolean).reduce((acc, x) => acc * x, 1)
|
|
99
|
+
|
|
100
|
+ }).reduce((acc, x) => acc + x, 0)
|
|
101
|
+
|
|
102
|
+ if (minPrice === 0 || minPrice > price) {
|
|
103
|
+ minPrice = price
|
|
104
|
+ }
|
|
105
|
+
|
|
106
|
+ maxPrice += maxPrice
|
|
107
|
+ })
|
|
108
|
+
|
|
109
|
+ return [minPrice, maxPrice]
|
|
110
|
+}
|
|
111
|
+
|
|
112
|
+// 胜平负
|
|
113
|
+function computeWDL (part, match, rq) {
|
|
114
|
+ const [x, y] = match
|
|
115
|
+ const { ruleCode, odds } = part.rules
|
|
116
|
+
|
|
117
|
+ switch (ruleCode) {
|
|
118
|
+ case 'ft-win':
|
|
119
|
+ return x > y ? odds : 0
|
|
120
|
+ case 'ft-dead':
|
|
121
|
+ return x == y ? odds : 0
|
|
122
|
+ default:
|
|
123
|
+ return x < y ? odds : 0
|
|
124
|
+ }
|
|
125
|
+}
|
|
126
|
+
|
|
127
|
+// 让球胜平负
|
|
128
|
+function computeWDLS (part, match, rq) {
|
|
129
|
+ const [x, y] = match
|
|
130
|
+ const { ruleCode, odds } = part.rules
|
|
131
|
+
|
|
132
|
+ switch (ruleCode) {
|
|
133
|
+ case 'ft-sp-win':
|
|
134
|
+ return x + rq > y ? odds : 0
|
|
135
|
+ case 'ft-sp-dead':
|
|
136
|
+ return x + rq == y ? odds : 0
|
|
137
|
+ default:
|
|
138
|
+ return x + rq < y ? odds : 0
|
|
139
|
+ }
|
|
140
|
+}
|
|
141
|
+
|
|
142
|
+// 比分
|
|
143
|
+function computeScore (part, match, rq) {
|
|
144
|
+ const [x, y] = match
|
|
145
|
+ const { ruleCode, odds } = part.rules
|
|
146
|
+
|
|
147
|
+ switch (ruleCode) {
|
|
148
|
+ case 'ft-w10':
|
|
149
|
+ return x == 1 && y == 0 ? odds : 0
|
|
150
|
+ case 'ft-w20':
|
|
151
|
+ return x == 2 && y == 0 ? odds : 0
|
|
152
|
+ case 'ft-w21':
|
|
153
|
+ return x == 2 && y == 1 ? odds : 0
|
|
154
|
+ case 'ft-w30':
|
|
155
|
+ return x == 3 && y == 0 ? odds : 0
|
|
156
|
+ case 'ft-w31':
|
|
157
|
+ return x == 3 && y == 1 ? odds : 0
|
|
158
|
+ case 'ft-w32':
|
|
159
|
+ return x == 3 && y == 2 ? odds : 0
|
|
160
|
+ case 'ft-w40':
|
|
161
|
+ return x == 4 && y == 0 ? odds : 0
|
|
162
|
+ case 'ft-w41':
|
|
163
|
+ return x == 4 && y == 1 ? odds : 0
|
|
164
|
+ case 'ft-w42':
|
|
165
|
+ return x == 4 && y == 2 ? odds : 0
|
|
166
|
+ case 'ft-w50':
|
|
167
|
+ return x == 5 && y == 0 ? odds : 0
|
|
168
|
+ case 'ft-w51':
|
|
169
|
+ return x == 5 && y == 1 ? odds : 0
|
|
170
|
+ case 'ft-w52':
|
|
171
|
+ return x == 5 && y == 2 ? odds : 0
|
|
172
|
+ case 'ft-w99':
|
|
173
|
+ return x > 5 && x > y ? odds : 0
|
|
174
|
+ case 'ft-d00':
|
|
175
|
+ return x == 0 && x == y ? odds : 0
|
|
176
|
+ case 'ft-d11':
|
|
177
|
+ return x == 1 && x == y ? odds : 0
|
|
178
|
+ case 'ft-d22':
|
|
179
|
+ return x == 2 && x == y ? odds : 0
|
|
180
|
+ case 'ft-d33':
|
|
181
|
+ return x == 3 && x == y ? odds : 0
|
|
182
|
+ case 'ft-d99':
|
|
183
|
+ return x > 5 && x == y ? odds : 0
|
|
184
|
+ case 'ft-l01':
|
|
185
|
+ return x == 0 && y == 1 ? odds : 0
|
|
186
|
+ case 'ft-l02':
|
|
187
|
+ return x == 0 && y == 2 ? odds : 0
|
|
188
|
+ case 'ft-l12':
|
|
189
|
+ return x == 1 && y == 2 ? odds : 0
|
|
190
|
+ case 'ft-l03':
|
|
191
|
+ return x == 0 && y == 3 ? odds : 0
|
|
192
|
+ case 'ft-l13':
|
|
193
|
+ return x == 1 && y == 3 ? odds : 0
|
|
194
|
+ case 'ft-l23':
|
|
195
|
+ return x == 2 && y == 3 ? odds : 0
|
|
196
|
+ case 'ft-l04':
|
|
197
|
+ return x == 0 && y == 4 ? odds : 0
|
|
198
|
+ case 'ft-l14':
|
|
199
|
+ return x == 1 && y == 4 ? odds : 0
|
|
200
|
+ case 'ft-l24':
|
|
201
|
+ return x == 2 && y == 4 ? odds : 0
|
|
202
|
+ case 'ft-l05':
|
|
203
|
+ return x == 0 && y == 5 ? odds : 0
|
|
204
|
+ case 'ft-l15':
|
|
205
|
+ return x == 1 && y == 5 ? odds : 0
|
|
206
|
+ case 'ft-l25':
|
|
207
|
+ return x == 2 && y == 5 ? odds : 0
|
|
208
|
+ default:
|
|
209
|
+ return x < y && y > 5 ? odds : 0
|
|
210
|
+ }
|
|
211
|
+}
|
|
212
|
+
|
|
213
|
+// 进球数
|
|
214
|
+function computePoints (part, match, rq) {
|
|
215
|
+ const [x, y] = match
|
|
216
|
+ const { ruleCode, odds } = part.rules
|
|
217
|
+
|
|
218
|
+ switch (ruleCode) {
|
|
219
|
+ case 'ft-p0':
|
|
220
|
+ return x == 0 && y == 0 ? odds : 0
|
|
221
|
+ case 'ft-p1':
|
|
222
|
+ return x + y == 1 ? odds : 0
|
|
223
|
+ case 'ft-p2':
|
|
224
|
+ return x + y == 2 ? odds : 0
|
|
225
|
+ case 'ft-p3':
|
|
226
|
+ return x + y == 3 ? odds : 0
|
|
227
|
+ case 'ft-p4':
|
|
228
|
+ return x + y == 4 ? odds : 0
|
|
229
|
+ case 'ft-p5':
|
|
230
|
+ return x + y == 5 ? odds : 0
|
|
231
|
+ case 'ft-p6':
|
|
232
|
+ return x + y == 6 ? odds : 0
|
|
233
|
+ default:
|
|
234
|
+ return x + y > 6 ? odds : 0
|
|
235
|
+ }
|
|
236
|
+}
|
|
237
|
+
|
|
238
|
+// 半全场
|
|
239
|
+function computeDouble (part, match, rq) {
|
|
240
|
+ const [x, y] = match
|
|
241
|
+ const { ruleCode, odds } = part.rules
|
|
242
|
+
|
|
243
|
+ switch (ruleCode) {
|
|
244
|
+ case 'ft-ww':
|
|
245
|
+ case 'ft-dw':
|
|
246
|
+ case 'ft-lw':
|
|
247
|
+ return x > y ? odds : 0
|
|
248
|
+ case 'ft-wd':
|
|
249
|
+ case 'ft-dd':
|
|
250
|
+ case 'ft-ld':
|
|
251
|
+ return x == y ? odds : 0
|
|
252
|
+ default:
|
|
253
|
+ return x < y ? odds : 0
|
|
254
|
+ }
|
|
255
|
+}
|
|
256
|
+
|
|
257
|
+export default GetAllParts
|