tx · T2DuyaA4XdGoMoZoc3iHGRCNCUyRGABVDcB2YYpZopZ 3N8DnpwTffUEjDXXEsn6btFrbgWC8VZJhTZ: -0.01400000 Waves 2021.06.04 05:35 [1555032] smart account 3N8DnpwTffUEjDXXEsn6btFrbgWC8VZJhTZ > SELF 0.00000000 Waves
{ "type": 13, "id": "T2DuyaA4XdGoMoZoc3iHGRCNCUyRGABVDcB2YYpZopZ", "fee": 1400000, "feeAssetId": null, "timestamp": 1622774108984, "version": 2, "chainId": 84, "sender": "3N8DnpwTffUEjDXXEsn6btFrbgWC8VZJhTZ", "senderPublicKey": "8uKVzAZCurBgbPFEaE9HYgJBH3oZsefwxNMgj4srAFJ9", "proofs": [ "rpgQkokBnmrE6XTk8PMMdBzJ7KGGEA6FPNYHYEb23mbtucW2G8BWLQQP62RbKUKpKGJwetY125mk3PpphFM5uPR" ], "script": "base64:AAIFAAAAAAAAAAoIAhIGCgQBAQEIAAAAAgAAAAAHaGFuZGlJZAEAAAAgmQAVX3L5MYxyaOxZ0FMoThkZR49kvwgxlwjo6C/iIRcBAAAAGWhhbmRpY2FwSW5kZXhSZXF1aXJlbWVudHMAAAABAAAAA251bQMJAABmAAAAAgUAAAADbnVtAAAAAAAAAAA2AAAAAAAAAAA2AwkAAGYAAAACAAAAAAAAAAAABQAAAANudW0AAAAAAAAAAAAFAAAAA251bQAAAAEAAAABaQEAAAAOcmVzdWx0SGFuZGljYXAAAAAEAAAAEnNjb3JlRGlmZmVyZW50aWFsMQAAABJzY29yZURpZmZlcmVudGlhbDIAAAASc2NvcmVEaWZmZXJlbnRpYWwzAAAACmN1cnJlbnRLZXkEAAAAF3Njb3JlRGlmZmVyZW50aWFsTG93ZXN0CQABlgAAAAEJAARMAAAAAgUAAAASc2NvcmVEaWZmZXJlbnRpYWwxCQAETAAAAAIFAAAAEnNjb3JlRGlmZmVyZW50aWFsMgkABEwAAAACBQAAABJzY29yZURpZmZlcmVudGlhbDMFAAAAA25pbAQAAAAGcmVzdWx0CQAAZQAAAAIFAAAAF3Njb3JlRGlmZmVyZW50aWFsTG93ZXN0AAAAAAAAAAACBAAAAA1oYW5kaWNhcEluZGV4CQEAAAAZaGFuZGljYXBJbmRleFJlcXVpcmVtZW50cwAAAAEFAAAABnJlc3VsdAkABRQAAAACCQAETAAAAAIJAQAAAAxCb29sZWFuRW50cnkAAAACAgAAAAZyZXN1bHQGCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIFAAAACmN1cnJlbnRLZXkCAAAADl9oYW5kaWNhcEluZGV4BQAAAA1oYW5kaWNhcEluZGV4CQAETAAAAAIJAQAAAAdSZWlzc3VlAAAAAwUAAAAHaGFuZGlJZAUAAAANaGFuZGljYXBJbmRleAcJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAA1oYW5kaWNhcEluZGV4BQAAAAdoYW5kaUlkBQAAAANuaWwFAAAADWhhbmRpY2FwSW5kZXgAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleTyUBIM=", "height": 1555032, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BQHGKJFcGdbczLnfFKpTsNt8fb8PV7F55fWtGN54oZ65 Next: 2XVy7W7F4c4AucAxAEnM9VjqHr5MsW3svXvqKivYuPS4 Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let handiId = base58'BJFTCAVHNhppygeLqYUyG5NB9GwNRjEjFeweJpXXi1DQ' | |
5 | 5 | ||
6 | - | func listSum (arr) = { | |
7 | - | func sum (a,b) = (a + b) | |
8 | - | ||
9 | - | let $list323344 = arr | |
10 | - | let $size323344 = size($list323344) | |
11 | - | let $acc0323344 = 0 | |
12 | - | if (($size323344 == 0)) | |
13 | - | then $acc0323344 | |
14 | - | else { | |
15 | - | let $acc1323344 = sum($acc0323344, $list323344[0]) | |
16 | - | if (($size323344 == 1)) | |
17 | - | then $acc1323344 | |
18 | - | else { | |
19 | - | let $acc2323344 = sum($acc1323344, $list323344[1]) | |
20 | - | if (($size323344 == 2)) | |
21 | - | then $acc2323344 | |
22 | - | else { | |
23 | - | let $acc3323344 = sum($acc2323344, $list323344[2]) | |
24 | - | if (($size323344 == 3)) | |
25 | - | then $acc3323344 | |
26 | - | else { | |
27 | - | let $acc4323344 = sum($acc3323344, $list323344[3]) | |
28 | - | if (($size323344 == 4)) | |
29 | - | then $acc4323344 | |
30 | - | else { | |
31 | - | let $acc5323344 = sum($acc4323344, $list323344[4]) | |
32 | - | if (($size323344 == 5)) | |
33 | - | then $acc5323344 | |
34 | - | else { | |
35 | - | let $acc6323344 = sum($acc5323344, $list323344[5]) | |
36 | - | if (($size323344 == 6)) | |
37 | - | then $acc6323344 | |
38 | - | else { | |
39 | - | let $acc7323344 = sum($acc6323344, $list323344[6]) | |
40 | - | if (($size323344 == 7)) | |
41 | - | then $acc7323344 | |
42 | - | else { | |
43 | - | let $acc8323344 = sum($acc7323344, $list323344[7]) | |
44 | - | if (($size323344 == 8)) | |
45 | - | then $acc8323344 | |
46 | - | else { | |
47 | - | let $acc9323344 = sum($acc8323344, $list323344[8]) | |
48 | - | if (($size323344 == 9)) | |
49 | - | then $acc9323344 | |
50 | - | else { | |
51 | - | let $acc10323344 = sum($acc9323344, $list323344[9]) | |
52 | - | if (($size323344 == 10)) | |
53 | - | then $acc10323344 | |
54 | - | else { | |
55 | - | let $acc11323344 = sum($acc10323344, $list323344[10]) | |
56 | - | if (($size323344 == 11)) | |
57 | - | then $acc11323344 | |
58 | - | else { | |
59 | - | let $acc12323344 = sum($acc11323344, $list323344[11]) | |
60 | - | if (($size323344 == 12)) | |
61 | - | then $acc12323344 | |
62 | - | else { | |
63 | - | let $acc13323344 = sum($acc12323344, $list323344[12]) | |
64 | - | if (($size323344 == 13)) | |
65 | - | then $acc13323344 | |
66 | - | else { | |
67 | - | let $acc14323344 = sum($acc13323344, $list323344[13]) | |
68 | - | if (($size323344 == 14)) | |
69 | - | then $acc14323344 | |
70 | - | else { | |
71 | - | let $acc15323344 = sum($acc14323344, $list323344[14]) | |
72 | - | if (($size323344 == 15)) | |
73 | - | then $acc15323344 | |
74 | - | else { | |
75 | - | let $acc16323344 = sum($acc15323344, $list323344[15]) | |
76 | - | if (($size323344 == 16)) | |
77 | - | then $acc16323344 | |
78 | - | else { | |
79 | - | let $acc17323344 = sum($acc16323344, $list323344[16]) | |
80 | - | if (($size323344 == 17)) | |
81 | - | then $acc17323344 | |
82 | - | else { | |
83 | - | let $acc18323344 = sum($acc17323344, $list323344[17]) | |
84 | - | if (($size323344 == 18)) | |
85 | - | then $acc18323344 | |
86 | - | else { | |
87 | - | let $acc19323344 = sum($acc18323344, $list323344[18]) | |
88 | - | throw("List size exceed 18") | |
89 | - | } | |
90 | - | } | |
91 | - | } | |
92 | - | } | |
93 | - | } | |
94 | - | } | |
95 | - | } | |
96 | - | } | |
97 | - | } | |
98 | - | } | |
99 | - | } | |
100 | - | } | |
101 | - | } | |
102 | - | } | |
103 | - | } | |
104 | - | } | |
105 | - | } | |
106 | - | } | |
107 | - | } | |
108 | - | } | |
6 | + | func handicapIndexRequirements (num) = if ((num > 54)) | |
7 | + | then 54 | |
8 | + | else if ((0 > num)) | |
9 | + | then 0 | |
10 | + | else num | |
109 | 11 | ||
110 | 12 | ||
111 | - | func parseIntList (arr) = { | |
112 | - | func foldFunc (list,a) = (list :+ parseIntValue(a)) | |
113 | - | ||
114 | - | let $list462489 = arr | |
115 | - | let $size462489 = size($list462489) | |
116 | - | let $acc0462489 = nil | |
117 | - | if (($size462489 == 0)) | |
118 | - | then $acc0462489 | |
119 | - | else { | |
120 | - | let $acc1462489 = foldFunc($acc0462489, $list462489[0]) | |
121 | - | if (($size462489 == 1)) | |
122 | - | then $acc1462489 | |
123 | - | else { | |
124 | - | let $acc2462489 = foldFunc($acc1462489, $list462489[1]) | |
125 | - | if (($size462489 == 2)) | |
126 | - | then $acc2462489 | |
127 | - | else { | |
128 | - | let $acc3462489 = foldFunc($acc2462489, $list462489[2]) | |
129 | - | if (($size462489 == 3)) | |
130 | - | then $acc3462489 | |
131 | - | else { | |
132 | - | let $acc4462489 = foldFunc($acc3462489, $list462489[3]) | |
133 | - | if (($size462489 == 4)) | |
134 | - | then $acc4462489 | |
135 | - | else { | |
136 | - | let $acc5462489 = foldFunc($acc4462489, $list462489[4]) | |
137 | - | if (($size462489 == 5)) | |
138 | - | then $acc5462489 | |
139 | - | else { | |
140 | - | let $acc6462489 = foldFunc($acc5462489, $list462489[5]) | |
141 | - | if (($size462489 == 6)) | |
142 | - | then $acc6462489 | |
143 | - | else { | |
144 | - | let $acc7462489 = foldFunc($acc6462489, $list462489[6]) | |
145 | - | if (($size462489 == 7)) | |
146 | - | then $acc7462489 | |
147 | - | else { | |
148 | - | let $acc8462489 = foldFunc($acc7462489, $list462489[7]) | |
149 | - | if (($size462489 == 8)) | |
150 | - | then $acc8462489 | |
151 | - | else { | |
152 | - | let $acc9462489 = foldFunc($acc8462489, $list462489[8]) | |
153 | - | if (($size462489 == 9)) | |
154 | - | then $acc9462489 | |
155 | - | else { | |
156 | - | let $acc10462489 = foldFunc($acc9462489, $list462489[9]) | |
157 | - | if (($size462489 == 10)) | |
158 | - | then $acc10462489 | |
159 | - | else { | |
160 | - | let $acc11462489 = foldFunc($acc10462489, $list462489[10]) | |
161 | - | if (($size462489 == 11)) | |
162 | - | then $acc11462489 | |
163 | - | else { | |
164 | - | let $acc12462489 = foldFunc($acc11462489, $list462489[11]) | |
165 | - | if (($size462489 == 12)) | |
166 | - | then $acc12462489 | |
167 | - | else { | |
168 | - | let $acc13462489 = foldFunc($acc12462489, $list462489[12]) | |
169 | - | if (($size462489 == 13)) | |
170 | - | then $acc13462489 | |
171 | - | else { | |
172 | - | let $acc14462489 = foldFunc($acc13462489, $list462489[13]) | |
173 | - | if (($size462489 == 14)) | |
174 | - | then $acc14462489 | |
175 | - | else { | |
176 | - | let $acc15462489 = foldFunc($acc14462489, $list462489[14]) | |
177 | - | if (($size462489 == 15)) | |
178 | - | then $acc15462489 | |
179 | - | else { | |
180 | - | let $acc16462489 = foldFunc($acc15462489, $list462489[15]) | |
181 | - | if (($size462489 == 16)) | |
182 | - | then $acc16462489 | |
183 | - | else { | |
184 | - | let $acc17462489 = foldFunc($acc16462489, $list462489[16]) | |
185 | - | if (($size462489 == 17)) | |
186 | - | then $acc17462489 | |
187 | - | else { | |
188 | - | let $acc18462489 = foldFunc($acc17462489, $list462489[17]) | |
189 | - | if (($size462489 == 18)) | |
190 | - | then $acc18462489 | |
191 | - | else { | |
192 | - | let $acc19462489 = foldFunc($acc18462489, $list462489[18]) | |
193 | - | throw("List size exceed 18") | |
194 | - | } | |
195 | - | } | |
196 | - | } | |
197 | - | } | |
198 | - | } | |
199 | - | } | |
200 | - | } | |
201 | - | } | |
202 | - | } | |
203 | - | } | |
204 | - | } | |
205 | - | } | |
206 | - | } | |
207 | - | } | |
208 | - | } | |
209 | - | } | |
210 | - | } | |
211 | - | } | |
212 | - | } | |
213 | - | } | |
214 | - | ||
215 | - | ||
216 | - | func getRoundScore (roundCount,currentKey) = match getString(this, ((currentKey + "_round_score_") + toString(roundCount))) { | |
217 | - | case a: String => | |
218 | - | a | |
219 | - | case _ => | |
220 | - | "" | |
221 | - | } | |
222 | - | ||
223 | - | ||
224 | - | func getRoundCourse (roundCount,currentKey) = match getString(this, ((currentKey + "_round_course_") + toString(roundCount))) { | |
225 | - | case a: String => | |
226 | - | a | |
227 | - | case _ => | |
228 | - | "" | |
229 | - | } | |
230 | - | ||
231 | - | ||
232 | - | func parse () = { | |
233 | - | let scoreList = ["6", "5", "4"] | |
234 | - | parseInt(scoreList[0]) | |
235 | - | } | |
236 | - | ||
237 | - | ||
238 | - | func holeStrokeReceiveFunc (handicapIndex,hdcp) = if ((handicapIndex >= hdcp)) | |
239 | - | then 1 | |
240 | - | else 0 | |
241 | - | ||
242 | - | ||
243 | - | func foldFuncHoldHandi (score,par,hdcpList,handicap) = { | |
244 | - | func foldFunc (acc,i) = { | |
245 | - | let holeStrokeReceive = holeStrokeReceiveFunc(handicap, hdcpList[i]) | |
246 | - | let netDoubleBogey = ((par[i] + 2) + holeStrokeReceive) | |
247 | - | if ((score[i] > netDoubleBogey)) | |
248 | - | then (acc :+ netDoubleBogey) | |
249 | - | else (acc :+ score[i]) | |
250 | - | } | |
251 | - | ||
252 | - | let $list15921623 = numList | |
253 | - | let $size15921623 = size($list15921623) | |
254 | - | let $acc015921623 = nil | |
255 | - | if (($size15921623 == 0)) | |
256 | - | then $acc015921623 | |
257 | - | else { | |
258 | - | let $acc115921623 = foldFunc($acc015921623, $list15921623[0]) | |
259 | - | if (($size15921623 == 1)) | |
260 | - | then $acc115921623 | |
261 | - | else { | |
262 | - | let $acc215921623 = foldFunc($acc115921623, $list15921623[1]) | |
263 | - | if (($size15921623 == 2)) | |
264 | - | then $acc215921623 | |
265 | - | else { | |
266 | - | let $acc315921623 = foldFunc($acc215921623, $list15921623[2]) | |
267 | - | if (($size15921623 == 3)) | |
268 | - | then $acc315921623 | |
269 | - | else { | |
270 | - | let $acc415921623 = foldFunc($acc315921623, $list15921623[3]) | |
271 | - | if (($size15921623 == 4)) | |
272 | - | then $acc415921623 | |
273 | - | else { | |
274 | - | let $acc515921623 = foldFunc($acc415921623, $list15921623[4]) | |
275 | - | if (($size15921623 == 5)) | |
276 | - | then $acc515921623 | |
277 | - | else { | |
278 | - | let $acc615921623 = foldFunc($acc515921623, $list15921623[5]) | |
279 | - | if (($size15921623 == 6)) | |
280 | - | then $acc615921623 | |
281 | - | else { | |
282 | - | let $acc715921623 = foldFunc($acc615921623, $list15921623[6]) | |
283 | - | if (($size15921623 == 7)) | |
284 | - | then $acc715921623 | |
285 | - | else { | |
286 | - | let $acc815921623 = foldFunc($acc715921623, $list15921623[7]) | |
287 | - | if (($size15921623 == 8)) | |
288 | - | then $acc815921623 | |
289 | - | else { | |
290 | - | let $acc915921623 = foldFunc($acc815921623, $list15921623[8]) | |
291 | - | if (($size15921623 == 9)) | |
292 | - | then $acc915921623 | |
293 | - | else { | |
294 | - | let $acc1015921623 = foldFunc($acc915921623, $list15921623[9]) | |
295 | - | if (($size15921623 == 10)) | |
296 | - | then $acc1015921623 | |
297 | - | else { | |
298 | - | let $acc1115921623 = foldFunc($acc1015921623, $list15921623[10]) | |
299 | - | if (($size15921623 == 11)) | |
300 | - | then $acc1115921623 | |
301 | - | else { | |
302 | - | let $acc1215921623 = foldFunc($acc1115921623, $list15921623[11]) | |
303 | - | if (($size15921623 == 12)) | |
304 | - | then $acc1215921623 | |
305 | - | else { | |
306 | - | let $acc1315921623 = foldFunc($acc1215921623, $list15921623[12]) | |
307 | - | if (($size15921623 == 13)) | |
308 | - | then $acc1315921623 | |
309 | - | else { | |
310 | - | let $acc1415921623 = foldFunc($acc1315921623, $list15921623[13]) | |
311 | - | if (($size15921623 == 14)) | |
312 | - | then $acc1415921623 | |
313 | - | else { | |
314 | - | let $acc1515921623 = foldFunc($acc1415921623, $list15921623[14]) | |
315 | - | if (($size15921623 == 15)) | |
316 | - | then $acc1515921623 | |
317 | - | else { | |
318 | - | let $acc1615921623 = foldFunc($acc1515921623, $list15921623[15]) | |
319 | - | if (($size15921623 == 16)) | |
320 | - | then $acc1615921623 | |
321 | - | else { | |
322 | - | let $acc1715921623 = foldFunc($acc1615921623, $list15921623[16]) | |
323 | - | if (($size15921623 == 17)) | |
324 | - | then $acc1715921623 | |
325 | - | else { | |
326 | - | let $acc1815921623 = foldFunc($acc1715921623, $list15921623[17]) | |
327 | - | if (($size15921623 == 18)) | |
328 | - | then $acc1815921623 | |
329 | - | else { | |
330 | - | let $acc1915921623 = foldFunc($acc1815921623, $list15921623[18]) | |
331 | - | throw("List size exceed 18") | |
332 | - | } | |
333 | - | } | |
334 | - | } | |
335 | - | } | |
336 | - | } | |
337 | - | } | |
338 | - | } | |
339 | - | } | |
340 | - | } | |
341 | - | } | |
342 | - | } | |
343 | - | } | |
344 | - | } | |
345 | - | } | |
346 | - | } | |
347 | - | } | |
348 | - | } | |
349 | - | } | |
350 | - | } | |
351 | - | } | |
352 | - | ||
353 | - | ||
354 | - | func foldFuncNoHandi (score,par) = { | |
355 | - | func foldFunc (acc,i) = if ((score[i] > (par[i] + 5))) | |
356 | - | then (acc :+ (par[i] + 5)) | |
357 | - | else (acc :+ score[i]) | |
358 | - | ||
359 | - | let $list18971928 = numList | |
360 | - | let $size18971928 = size($list18971928) | |
361 | - | let $acc018971928 = nil | |
362 | - | if (($size18971928 == 0)) | |
363 | - | then $acc018971928 | |
364 | - | else { | |
365 | - | let $acc118971928 = foldFunc($acc018971928, $list18971928[0]) | |
366 | - | if (($size18971928 == 1)) | |
367 | - | then $acc118971928 | |
368 | - | else { | |
369 | - | let $acc218971928 = foldFunc($acc118971928, $list18971928[1]) | |
370 | - | if (($size18971928 == 2)) | |
371 | - | then $acc218971928 | |
372 | - | else { | |
373 | - | let $acc318971928 = foldFunc($acc218971928, $list18971928[2]) | |
374 | - | if (($size18971928 == 3)) | |
375 | - | then $acc318971928 | |
376 | - | else { | |
377 | - | let $acc418971928 = foldFunc($acc318971928, $list18971928[3]) | |
378 | - | if (($size18971928 == 4)) | |
379 | - | then $acc418971928 | |
380 | - | else { | |
381 | - | let $acc518971928 = foldFunc($acc418971928, $list18971928[4]) | |
382 | - | if (($size18971928 == 5)) | |
383 | - | then $acc518971928 | |
384 | - | else { | |
385 | - | let $acc618971928 = foldFunc($acc518971928, $list18971928[5]) | |
386 | - | if (($size18971928 == 6)) | |
387 | - | then $acc618971928 | |
388 | - | else { | |
389 | - | let $acc718971928 = foldFunc($acc618971928, $list18971928[6]) | |
390 | - | if (($size18971928 == 7)) | |
391 | - | then $acc718971928 | |
392 | - | else { | |
393 | - | let $acc818971928 = foldFunc($acc718971928, $list18971928[7]) | |
394 | - | if (($size18971928 == 8)) | |
395 | - | then $acc818971928 | |
396 | - | else { | |
397 | - | let $acc918971928 = foldFunc($acc818971928, $list18971928[8]) | |
398 | - | if (($size18971928 == 9)) | |
399 | - | then $acc918971928 | |
400 | - | else { | |
401 | - | let $acc1018971928 = foldFunc($acc918971928, $list18971928[9]) | |
402 | - | if (($size18971928 == 10)) | |
403 | - | then $acc1018971928 | |
404 | - | else { | |
405 | - | let $acc1118971928 = foldFunc($acc1018971928, $list18971928[10]) | |
406 | - | if (($size18971928 == 11)) | |
407 | - | then $acc1118971928 | |
408 | - | else { | |
409 | - | let $acc1218971928 = foldFunc($acc1118971928, $list18971928[11]) | |
410 | - | if (($size18971928 == 12)) | |
411 | - | then $acc1218971928 | |
412 | - | else { | |
413 | - | let $acc1318971928 = foldFunc($acc1218971928, $list18971928[12]) | |
414 | - | if (($size18971928 == 13)) | |
415 | - | then $acc1318971928 | |
416 | - | else { | |
417 | - | let $acc1418971928 = foldFunc($acc1318971928, $list18971928[13]) | |
418 | - | if (($size18971928 == 14)) | |
419 | - | then $acc1418971928 | |
420 | - | else { | |
421 | - | let $acc1518971928 = foldFunc($acc1418971928, $list18971928[14]) | |
422 | - | if (($size18971928 == 15)) | |
423 | - | then $acc1518971928 | |
424 | - | else { | |
425 | - | let $acc1618971928 = foldFunc($acc1518971928, $list18971928[15]) | |
426 | - | if (($size18971928 == 16)) | |
427 | - | then $acc1618971928 | |
428 | - | else { | |
429 | - | let $acc1718971928 = foldFunc($acc1618971928, $list18971928[16]) | |
430 | - | if (($size18971928 == 17)) | |
431 | - | then $acc1718971928 | |
432 | - | else { | |
433 | - | let $acc1818971928 = foldFunc($acc1718971928, $list18971928[17]) | |
434 | - | if (($size18971928 == 18)) | |
435 | - | then $acc1818971928 | |
436 | - | else { | |
437 | - | let $acc1918971928 = foldFunc($acc1818971928, $list18971928[18]) | |
438 | - | throw("List size exceed 18") | |
439 | - | } | |
440 | - | } | |
441 | - | } | |
442 | - | } | |
443 | - | } | |
444 | - | } | |
445 | - | } | |
446 | - | } | |
447 | - | } | |
448 | - | } | |
449 | - | } | |
450 | - | } | |
451 | - | } | |
452 | - | } | |
453 | - | } | |
454 | - | } | |
455 | - | } | |
456 | - | } | |
457 | - | } | |
458 | - | } | |
459 | - | ||
460 | - | ||
461 | - | func scoreAdjustmentCalc (score,par,hdcpList,handicap) = if ((handicap == -1)) | |
462 | - | then foldFuncNoHandi(score, par) | |
463 | - | else foldFuncHoldHandi(score, par, hdcpList, handicap) | |
464 | - | ||
465 | - | ||
466 | - | func scoreDifferential (scoreList,parList,hdcpList,courseRating,slopeRating,handicap) = { | |
467 | - | let scoreAdjustmentList = scoreAdjustmentCalc(scoreList, parList, hdcpList, handicap) | |
468 | - | let scoreAdjustedTotal = listSum(scoreAdjustmentList) | |
469 | - | let scoreSum = listSum(scoreList) | |
470 | - | let pcc = 0 | |
471 | - | let a = (113 / slopeRating) | |
472 | - | let b = ((scoreAdjustedTotal - courseRating) - pcc) | |
473 | - | let c = 1 | |
474 | - | let result = fraction(a, b, c, HALFUP) | |
475 | - | result | |
476 | - | } | |
477 | - | ||
478 | - | ||
479 | - | let count = 1 | |
480 | - | ||
481 | 13 | @Callable(i) | |
482 | - | func issueHandicapIndex (coursePar1Str,coursePar2Str,coursePar3Str,courseHdcp1Str,courseHdcp2Str,courseHdcp3Str) = { | |
483 | - | let currentKey = toBase58String(i.caller.bytes) | |
484 | - | let getHandicapIndex = 20 | |
485 | - | let getRoundCount = match getInteger(this, (currentKey + "_round_count")) { | |
486 | - | case a: Int => | |
487 | - | a | |
488 | - | case _ => | |
489 | - | -1 | |
490 | - | } | |
491 | - | let scoreString = "4_&&_6_&&_7_&&_4_&&_7_&&_8_&&_5_&&_8_&&_6_&&_6_&&_7_&&_8_&&_6_&&_6_&&_5_&&_7_&&_7_&&_6" | |
492 | - | let roundCourseString = "3N8DnpwTffUEjDXXEsn6btFrbgWC8VZJhTZ_&&_course_1_&&_course_2_&&_green_1_&&_70_&&_110_&&_men_&&_1622640688000_&&_cloudy_&&_11" | |
493 | - | let coursePar = "4_&&_4_&&_4_&&_4_&&_3_&&_5_&&_4_&&_5_&&_6_&&_5_&&_3_&&_5_&&_4_&&_4_&&_5_&&_4_&&_4_&&_4" | |
494 | - | let courseHdcp = "1_&&_2_&&_3_&&_4_&&_5_&&_6_&&_7_&&_8_&&_9_&&_10_&&_11_&&_12_&&_13_&&_14_&&_15_&&_16_&&_17_&&_18" | |
495 | - | let score1 = parseIntList(split(getRoundScore(getRoundCount, currentKey), "_&&_")) | |
496 | - | let score2 = parseIntList(split(getRoundScore((getRoundCount - 1), currentKey), "_&&_")) | |
497 | - | let score3 = parseIntList(split(getRoundScore((getRoundCount - 2), currentKey), "_&&_")) | |
498 | - | let roundCourse1 = split(getRoundCourse(getRoundCount, currentKey), "_&&_") | |
499 | - | let roundCourse2 = split(getRoundCourse((getRoundCount - 1), currentKey), "_&&_") | |
500 | - | let roundCourse3 = split(getRoundCourse((getRoundCount - 2), currentKey), "_&&_") | |
501 | - | let coursePar1 = parseIntList(split(coursePar1Str, "_&&_")) | |
502 | - | let coursePar2 = parseIntList(split(coursePar2Str, "_&&_")) | |
503 | - | let coursePar3 = parseIntList(split(coursePar3Str, "_&&_")) | |
504 | - | let courseHdcp1 = parseIntList(split(courseHdcp1Str, "_&&_")) | |
505 | - | let courseHdcp2 = parseIntList(split(courseHdcp2Str, "_&&_")) | |
506 | - | let courseHdcp3 = parseIntList(split(courseHdcp3Str, "_&&_")) | |
507 | - | let scoreDifferential1 = scoreDifferential(score1, coursePar1, courseHdcp1, parseIntValue(roundCourse1[5]), parseIntValue(roundCourse1[6]), getHandicapIndex) | |
508 | - | let scoreDifferential2 = scoreDifferential(score2, coursePar2, courseHdcp2, parseIntValue(roundCourse2[5]), parseIntValue(roundCourse2[6]), getHandicapIndex) | |
509 | - | let scoreDifferential3 = scoreDifferential(score3, coursePar3, courseHdcp3, parseIntValue(roundCourse3[5]), parseIntValue(roundCourse3[6]), getHandicapIndex) | |
510 | - | let resultHandicapDapp = "3My7znnhd1L35kRQZWXJXZa6PBDfr9oN6Wu" | |
511 | - | let handicapIndex = invoke(addressFromStringValue(resultHandicapDapp), "resultHandicap", [scoreDifferential1, scoreDifferential2, scoreDifferential3, currentKey], nil) | |
512 | - | nil | |
14 | + | func resultHandicap (scoreDifferential1,scoreDifferential2,scoreDifferential3,currentKey) = { | |
15 | + | let scoreDifferentialLowest = max([scoreDifferential1, scoreDifferential2, scoreDifferential3]) | |
16 | + | let result = (scoreDifferentialLowest - 2) | |
17 | + | let handicapIndex = handicapIndexRequirements(result) | |
18 | + | $Tuple2([BooleanEntry("result", true), IntegerEntry((currentKey + "_handicapIndex"), handicapIndex), Reissue(handiId, handicapIndex, false), ScriptTransfer(i.caller, handicapIndex, handiId)], handicapIndex) | |
513 | 19 | } | |
514 | 20 | ||
515 | 21 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let handiId = base58'BJFTCAVHNhppygeLqYUyG5NB9GwNRjEjFeweJpXXi1DQ' | |
5 | 5 | ||
6 | - | func listSum (arr) = { | |
7 | - | func sum (a,b) = (a + b) | |
8 | - | ||
9 | - | let $list323344 = arr | |
10 | - | let $size323344 = size($list323344) | |
11 | - | let $acc0323344 = 0 | |
12 | - | if (($size323344 == 0)) | |
13 | - | then $acc0323344 | |
14 | - | else { | |
15 | - | let $acc1323344 = sum($acc0323344, $list323344[0]) | |
16 | - | if (($size323344 == 1)) | |
17 | - | then $acc1323344 | |
18 | - | else { | |
19 | - | let $acc2323344 = sum($acc1323344, $list323344[1]) | |
20 | - | if (($size323344 == 2)) | |
21 | - | then $acc2323344 | |
22 | - | else { | |
23 | - | let $acc3323344 = sum($acc2323344, $list323344[2]) | |
24 | - | if (($size323344 == 3)) | |
25 | - | then $acc3323344 | |
26 | - | else { | |
27 | - | let $acc4323344 = sum($acc3323344, $list323344[3]) | |
28 | - | if (($size323344 == 4)) | |
29 | - | then $acc4323344 | |
30 | - | else { | |
31 | - | let $acc5323344 = sum($acc4323344, $list323344[4]) | |
32 | - | if (($size323344 == 5)) | |
33 | - | then $acc5323344 | |
34 | - | else { | |
35 | - | let $acc6323344 = sum($acc5323344, $list323344[5]) | |
36 | - | if (($size323344 == 6)) | |
37 | - | then $acc6323344 | |
38 | - | else { | |
39 | - | let $acc7323344 = sum($acc6323344, $list323344[6]) | |
40 | - | if (($size323344 == 7)) | |
41 | - | then $acc7323344 | |
42 | - | else { | |
43 | - | let $acc8323344 = sum($acc7323344, $list323344[7]) | |
44 | - | if (($size323344 == 8)) | |
45 | - | then $acc8323344 | |
46 | - | else { | |
47 | - | let $acc9323344 = sum($acc8323344, $list323344[8]) | |
48 | - | if (($size323344 == 9)) | |
49 | - | then $acc9323344 | |
50 | - | else { | |
51 | - | let $acc10323344 = sum($acc9323344, $list323344[9]) | |
52 | - | if (($size323344 == 10)) | |
53 | - | then $acc10323344 | |
54 | - | else { | |
55 | - | let $acc11323344 = sum($acc10323344, $list323344[10]) | |
56 | - | if (($size323344 == 11)) | |
57 | - | then $acc11323344 | |
58 | - | else { | |
59 | - | let $acc12323344 = sum($acc11323344, $list323344[11]) | |
60 | - | if (($size323344 == 12)) | |
61 | - | then $acc12323344 | |
62 | - | else { | |
63 | - | let $acc13323344 = sum($acc12323344, $list323344[12]) | |
64 | - | if (($size323344 == 13)) | |
65 | - | then $acc13323344 | |
66 | - | else { | |
67 | - | let $acc14323344 = sum($acc13323344, $list323344[13]) | |
68 | - | if (($size323344 == 14)) | |
69 | - | then $acc14323344 | |
70 | - | else { | |
71 | - | let $acc15323344 = sum($acc14323344, $list323344[14]) | |
72 | - | if (($size323344 == 15)) | |
73 | - | then $acc15323344 | |
74 | - | else { | |
75 | - | let $acc16323344 = sum($acc15323344, $list323344[15]) | |
76 | - | if (($size323344 == 16)) | |
77 | - | then $acc16323344 | |
78 | - | else { | |
79 | - | let $acc17323344 = sum($acc16323344, $list323344[16]) | |
80 | - | if (($size323344 == 17)) | |
81 | - | then $acc17323344 | |
82 | - | else { | |
83 | - | let $acc18323344 = sum($acc17323344, $list323344[17]) | |
84 | - | if (($size323344 == 18)) | |
85 | - | then $acc18323344 | |
86 | - | else { | |
87 | - | let $acc19323344 = sum($acc18323344, $list323344[18]) | |
88 | - | throw("List size exceed 18") | |
89 | - | } | |
90 | - | } | |
91 | - | } | |
92 | - | } | |
93 | - | } | |
94 | - | } | |
95 | - | } | |
96 | - | } | |
97 | - | } | |
98 | - | } | |
99 | - | } | |
100 | - | } | |
101 | - | } | |
102 | - | } | |
103 | - | } | |
104 | - | } | |
105 | - | } | |
106 | - | } | |
107 | - | } | |
108 | - | } | |
6 | + | func handicapIndexRequirements (num) = if ((num > 54)) | |
7 | + | then 54 | |
8 | + | else if ((0 > num)) | |
9 | + | then 0 | |
10 | + | else num | |
109 | 11 | ||
110 | 12 | ||
111 | - | func parseIntList (arr) = { | |
112 | - | func foldFunc (list,a) = (list :+ parseIntValue(a)) | |
113 | - | ||
114 | - | let $list462489 = arr | |
115 | - | let $size462489 = size($list462489) | |
116 | - | let $acc0462489 = nil | |
117 | - | if (($size462489 == 0)) | |
118 | - | then $acc0462489 | |
119 | - | else { | |
120 | - | let $acc1462489 = foldFunc($acc0462489, $list462489[0]) | |
121 | - | if (($size462489 == 1)) | |
122 | - | then $acc1462489 | |
123 | - | else { | |
124 | - | let $acc2462489 = foldFunc($acc1462489, $list462489[1]) | |
125 | - | if (($size462489 == 2)) | |
126 | - | then $acc2462489 | |
127 | - | else { | |
128 | - | let $acc3462489 = foldFunc($acc2462489, $list462489[2]) | |
129 | - | if (($size462489 == 3)) | |
130 | - | then $acc3462489 | |
131 | - | else { | |
132 | - | let $acc4462489 = foldFunc($acc3462489, $list462489[3]) | |
133 | - | if (($size462489 == 4)) | |
134 | - | then $acc4462489 | |
135 | - | else { | |
136 | - | let $acc5462489 = foldFunc($acc4462489, $list462489[4]) | |
137 | - | if (($size462489 == 5)) | |
138 | - | then $acc5462489 | |
139 | - | else { | |
140 | - | let $acc6462489 = foldFunc($acc5462489, $list462489[5]) | |
141 | - | if (($size462489 == 6)) | |
142 | - | then $acc6462489 | |
143 | - | else { | |
144 | - | let $acc7462489 = foldFunc($acc6462489, $list462489[6]) | |
145 | - | if (($size462489 == 7)) | |
146 | - | then $acc7462489 | |
147 | - | else { | |
148 | - | let $acc8462489 = foldFunc($acc7462489, $list462489[7]) | |
149 | - | if (($size462489 == 8)) | |
150 | - | then $acc8462489 | |
151 | - | else { | |
152 | - | let $acc9462489 = foldFunc($acc8462489, $list462489[8]) | |
153 | - | if (($size462489 == 9)) | |
154 | - | then $acc9462489 | |
155 | - | else { | |
156 | - | let $acc10462489 = foldFunc($acc9462489, $list462489[9]) | |
157 | - | if (($size462489 == 10)) | |
158 | - | then $acc10462489 | |
159 | - | else { | |
160 | - | let $acc11462489 = foldFunc($acc10462489, $list462489[10]) | |
161 | - | if (($size462489 == 11)) | |
162 | - | then $acc11462489 | |
163 | - | else { | |
164 | - | let $acc12462489 = foldFunc($acc11462489, $list462489[11]) | |
165 | - | if (($size462489 == 12)) | |
166 | - | then $acc12462489 | |
167 | - | else { | |
168 | - | let $acc13462489 = foldFunc($acc12462489, $list462489[12]) | |
169 | - | if (($size462489 == 13)) | |
170 | - | then $acc13462489 | |
171 | - | else { | |
172 | - | let $acc14462489 = foldFunc($acc13462489, $list462489[13]) | |
173 | - | if (($size462489 == 14)) | |
174 | - | then $acc14462489 | |
175 | - | else { | |
176 | - | let $acc15462489 = foldFunc($acc14462489, $list462489[14]) | |
177 | - | if (($size462489 == 15)) | |
178 | - | then $acc15462489 | |
179 | - | else { | |
180 | - | let $acc16462489 = foldFunc($acc15462489, $list462489[15]) | |
181 | - | if (($size462489 == 16)) | |
182 | - | then $acc16462489 | |
183 | - | else { | |
184 | - | let $acc17462489 = foldFunc($acc16462489, $list462489[16]) | |
185 | - | if (($size462489 == 17)) | |
186 | - | then $acc17462489 | |
187 | - | else { | |
188 | - | let $acc18462489 = foldFunc($acc17462489, $list462489[17]) | |
189 | - | if (($size462489 == 18)) | |
190 | - | then $acc18462489 | |
191 | - | else { | |
192 | - | let $acc19462489 = foldFunc($acc18462489, $list462489[18]) | |
193 | - | throw("List size exceed 18") | |
194 | - | } | |
195 | - | } | |
196 | - | } | |
197 | - | } | |
198 | - | } | |
199 | - | } | |
200 | - | } | |
201 | - | } | |
202 | - | } | |
203 | - | } | |
204 | - | } | |
205 | - | } | |
206 | - | } | |
207 | - | } | |
208 | - | } | |
209 | - | } | |
210 | - | } | |
211 | - | } | |
212 | - | } | |
213 | - | } | |
214 | - | ||
215 | - | ||
216 | - | func getRoundScore (roundCount,currentKey) = match getString(this, ((currentKey + "_round_score_") + toString(roundCount))) { | |
217 | - | case a: String => | |
218 | - | a | |
219 | - | case _ => | |
220 | - | "" | |
221 | - | } | |
222 | - | ||
223 | - | ||
224 | - | func getRoundCourse (roundCount,currentKey) = match getString(this, ((currentKey + "_round_course_") + toString(roundCount))) { | |
225 | - | case a: String => | |
226 | - | a | |
227 | - | case _ => | |
228 | - | "" | |
229 | - | } | |
230 | - | ||
231 | - | ||
232 | - | func parse () = { | |
233 | - | let scoreList = ["6", "5", "4"] | |
234 | - | parseInt(scoreList[0]) | |
235 | - | } | |
236 | - | ||
237 | - | ||
238 | - | func holeStrokeReceiveFunc (handicapIndex,hdcp) = if ((handicapIndex >= hdcp)) | |
239 | - | then 1 | |
240 | - | else 0 | |
241 | - | ||
242 | - | ||
243 | - | func foldFuncHoldHandi (score,par,hdcpList,handicap) = { | |
244 | - | func foldFunc (acc,i) = { | |
245 | - | let holeStrokeReceive = holeStrokeReceiveFunc(handicap, hdcpList[i]) | |
246 | - | let netDoubleBogey = ((par[i] + 2) + holeStrokeReceive) | |
247 | - | if ((score[i] > netDoubleBogey)) | |
248 | - | then (acc :+ netDoubleBogey) | |
249 | - | else (acc :+ score[i]) | |
250 | - | } | |
251 | - | ||
252 | - | let $list15921623 = numList | |
253 | - | let $size15921623 = size($list15921623) | |
254 | - | let $acc015921623 = nil | |
255 | - | if (($size15921623 == 0)) | |
256 | - | then $acc015921623 | |
257 | - | else { | |
258 | - | let $acc115921623 = foldFunc($acc015921623, $list15921623[0]) | |
259 | - | if (($size15921623 == 1)) | |
260 | - | then $acc115921623 | |
261 | - | else { | |
262 | - | let $acc215921623 = foldFunc($acc115921623, $list15921623[1]) | |
263 | - | if (($size15921623 == 2)) | |
264 | - | then $acc215921623 | |
265 | - | else { | |
266 | - | let $acc315921623 = foldFunc($acc215921623, $list15921623[2]) | |
267 | - | if (($size15921623 == 3)) | |
268 | - | then $acc315921623 | |
269 | - | else { | |
270 | - | let $acc415921623 = foldFunc($acc315921623, $list15921623[3]) | |
271 | - | if (($size15921623 == 4)) | |
272 | - | then $acc415921623 | |
273 | - | else { | |
274 | - | let $acc515921623 = foldFunc($acc415921623, $list15921623[4]) | |
275 | - | if (($size15921623 == 5)) | |
276 | - | then $acc515921623 | |
277 | - | else { | |
278 | - | let $acc615921623 = foldFunc($acc515921623, $list15921623[5]) | |
279 | - | if (($size15921623 == 6)) | |
280 | - | then $acc615921623 | |
281 | - | else { | |
282 | - | let $acc715921623 = foldFunc($acc615921623, $list15921623[6]) | |
283 | - | if (($size15921623 == 7)) | |
284 | - | then $acc715921623 | |
285 | - | else { | |
286 | - | let $acc815921623 = foldFunc($acc715921623, $list15921623[7]) | |
287 | - | if (($size15921623 == 8)) | |
288 | - | then $acc815921623 | |
289 | - | else { | |
290 | - | let $acc915921623 = foldFunc($acc815921623, $list15921623[8]) | |
291 | - | if (($size15921623 == 9)) | |
292 | - | then $acc915921623 | |
293 | - | else { | |
294 | - | let $acc1015921623 = foldFunc($acc915921623, $list15921623[9]) | |
295 | - | if (($size15921623 == 10)) | |
296 | - | then $acc1015921623 | |
297 | - | else { | |
298 | - | let $acc1115921623 = foldFunc($acc1015921623, $list15921623[10]) | |
299 | - | if (($size15921623 == 11)) | |
300 | - | then $acc1115921623 | |
301 | - | else { | |
302 | - | let $acc1215921623 = foldFunc($acc1115921623, $list15921623[11]) | |
303 | - | if (($size15921623 == 12)) | |
304 | - | then $acc1215921623 | |
305 | - | else { | |
306 | - | let $acc1315921623 = foldFunc($acc1215921623, $list15921623[12]) | |
307 | - | if (($size15921623 == 13)) | |
308 | - | then $acc1315921623 | |
309 | - | else { | |
310 | - | let $acc1415921623 = foldFunc($acc1315921623, $list15921623[13]) | |
311 | - | if (($size15921623 == 14)) | |
312 | - | then $acc1415921623 | |
313 | - | else { | |
314 | - | let $acc1515921623 = foldFunc($acc1415921623, $list15921623[14]) | |
315 | - | if (($size15921623 == 15)) | |
316 | - | then $acc1515921623 | |
317 | - | else { | |
318 | - | let $acc1615921623 = foldFunc($acc1515921623, $list15921623[15]) | |
319 | - | if (($size15921623 == 16)) | |
320 | - | then $acc1615921623 | |
321 | - | else { | |
322 | - | let $acc1715921623 = foldFunc($acc1615921623, $list15921623[16]) | |
323 | - | if (($size15921623 == 17)) | |
324 | - | then $acc1715921623 | |
325 | - | else { | |
326 | - | let $acc1815921623 = foldFunc($acc1715921623, $list15921623[17]) | |
327 | - | if (($size15921623 == 18)) | |
328 | - | then $acc1815921623 | |
329 | - | else { | |
330 | - | let $acc1915921623 = foldFunc($acc1815921623, $list15921623[18]) | |
331 | - | throw("List size exceed 18") | |
332 | - | } | |
333 | - | } | |
334 | - | } | |
335 | - | } | |
336 | - | } | |
337 | - | } | |
338 | - | } | |
339 | - | } | |
340 | - | } | |
341 | - | } | |
342 | - | } | |
343 | - | } | |
344 | - | } | |
345 | - | } | |
346 | - | } | |
347 | - | } | |
348 | - | } | |
349 | - | } | |
350 | - | } | |
351 | - | } | |
352 | - | ||
353 | - | ||
354 | - | func foldFuncNoHandi (score,par) = { | |
355 | - | func foldFunc (acc,i) = if ((score[i] > (par[i] + 5))) | |
356 | - | then (acc :+ (par[i] + 5)) | |
357 | - | else (acc :+ score[i]) | |
358 | - | ||
359 | - | let $list18971928 = numList | |
360 | - | let $size18971928 = size($list18971928) | |
361 | - | let $acc018971928 = nil | |
362 | - | if (($size18971928 == 0)) | |
363 | - | then $acc018971928 | |
364 | - | else { | |
365 | - | let $acc118971928 = foldFunc($acc018971928, $list18971928[0]) | |
366 | - | if (($size18971928 == 1)) | |
367 | - | then $acc118971928 | |
368 | - | else { | |
369 | - | let $acc218971928 = foldFunc($acc118971928, $list18971928[1]) | |
370 | - | if (($size18971928 == 2)) | |
371 | - | then $acc218971928 | |
372 | - | else { | |
373 | - | let $acc318971928 = foldFunc($acc218971928, $list18971928[2]) | |
374 | - | if (($size18971928 == 3)) | |
375 | - | then $acc318971928 | |
376 | - | else { | |
377 | - | let $acc418971928 = foldFunc($acc318971928, $list18971928[3]) | |
378 | - | if (($size18971928 == 4)) | |
379 | - | then $acc418971928 | |
380 | - | else { | |
381 | - | let $acc518971928 = foldFunc($acc418971928, $list18971928[4]) | |
382 | - | if (($size18971928 == 5)) | |
383 | - | then $acc518971928 | |
384 | - | else { | |
385 | - | let $acc618971928 = foldFunc($acc518971928, $list18971928[5]) | |
386 | - | if (($size18971928 == 6)) | |
387 | - | then $acc618971928 | |
388 | - | else { | |
389 | - | let $acc718971928 = foldFunc($acc618971928, $list18971928[6]) | |
390 | - | if (($size18971928 == 7)) | |
391 | - | then $acc718971928 | |
392 | - | else { | |
393 | - | let $acc818971928 = foldFunc($acc718971928, $list18971928[7]) | |
394 | - | if (($size18971928 == 8)) | |
395 | - | then $acc818971928 | |
396 | - | else { | |
397 | - | let $acc918971928 = foldFunc($acc818971928, $list18971928[8]) | |
398 | - | if (($size18971928 == 9)) | |
399 | - | then $acc918971928 | |
400 | - | else { | |
401 | - | let $acc1018971928 = foldFunc($acc918971928, $list18971928[9]) | |
402 | - | if (($size18971928 == 10)) | |
403 | - | then $acc1018971928 | |
404 | - | else { | |
405 | - | let $acc1118971928 = foldFunc($acc1018971928, $list18971928[10]) | |
406 | - | if (($size18971928 == 11)) | |
407 | - | then $acc1118971928 | |
408 | - | else { | |
409 | - | let $acc1218971928 = foldFunc($acc1118971928, $list18971928[11]) | |
410 | - | if (($size18971928 == 12)) | |
411 | - | then $acc1218971928 | |
412 | - | else { | |
413 | - | let $acc1318971928 = foldFunc($acc1218971928, $list18971928[12]) | |
414 | - | if (($size18971928 == 13)) | |
415 | - | then $acc1318971928 | |
416 | - | else { | |
417 | - | let $acc1418971928 = foldFunc($acc1318971928, $list18971928[13]) | |
418 | - | if (($size18971928 == 14)) | |
419 | - | then $acc1418971928 | |
420 | - | else { | |
421 | - | let $acc1518971928 = foldFunc($acc1418971928, $list18971928[14]) | |
422 | - | if (($size18971928 == 15)) | |
423 | - | then $acc1518971928 | |
424 | - | else { | |
425 | - | let $acc1618971928 = foldFunc($acc1518971928, $list18971928[15]) | |
426 | - | if (($size18971928 == 16)) | |
427 | - | then $acc1618971928 | |
428 | - | else { | |
429 | - | let $acc1718971928 = foldFunc($acc1618971928, $list18971928[16]) | |
430 | - | if (($size18971928 == 17)) | |
431 | - | then $acc1718971928 | |
432 | - | else { | |
433 | - | let $acc1818971928 = foldFunc($acc1718971928, $list18971928[17]) | |
434 | - | if (($size18971928 == 18)) | |
435 | - | then $acc1818971928 | |
436 | - | else { | |
437 | - | let $acc1918971928 = foldFunc($acc1818971928, $list18971928[18]) | |
438 | - | throw("List size exceed 18") | |
439 | - | } | |
440 | - | } | |
441 | - | } | |
442 | - | } | |
443 | - | } | |
444 | - | } | |
445 | - | } | |
446 | - | } | |
447 | - | } | |
448 | - | } | |
449 | - | } | |
450 | - | } | |
451 | - | } | |
452 | - | } | |
453 | - | } | |
454 | - | } | |
455 | - | } | |
456 | - | } | |
457 | - | } | |
458 | - | } | |
459 | - | ||
460 | - | ||
461 | - | func scoreAdjustmentCalc (score,par,hdcpList,handicap) = if ((handicap == -1)) | |
462 | - | then foldFuncNoHandi(score, par) | |
463 | - | else foldFuncHoldHandi(score, par, hdcpList, handicap) | |
464 | - | ||
465 | - | ||
466 | - | func scoreDifferential (scoreList,parList,hdcpList,courseRating,slopeRating,handicap) = { | |
467 | - | let scoreAdjustmentList = scoreAdjustmentCalc(scoreList, parList, hdcpList, handicap) | |
468 | - | let scoreAdjustedTotal = listSum(scoreAdjustmentList) | |
469 | - | let scoreSum = listSum(scoreList) | |
470 | - | let pcc = 0 | |
471 | - | let a = (113 / slopeRating) | |
472 | - | let b = ((scoreAdjustedTotal - courseRating) - pcc) | |
473 | - | let c = 1 | |
474 | - | let result = fraction(a, b, c, HALFUP) | |
475 | - | result | |
476 | - | } | |
477 | - | ||
478 | - | ||
479 | - | let count = 1 | |
480 | - | ||
481 | 13 | @Callable(i) | |
482 | - | func issueHandicapIndex (coursePar1Str,coursePar2Str,coursePar3Str,courseHdcp1Str,courseHdcp2Str,courseHdcp3Str) = { | |
483 | - | let currentKey = toBase58String(i.caller.bytes) | |
484 | - | let getHandicapIndex = 20 | |
485 | - | let getRoundCount = match getInteger(this, (currentKey + "_round_count")) { | |
486 | - | case a: Int => | |
487 | - | a | |
488 | - | case _ => | |
489 | - | -1 | |
490 | - | } | |
491 | - | let scoreString = "4_&&_6_&&_7_&&_4_&&_7_&&_8_&&_5_&&_8_&&_6_&&_6_&&_7_&&_8_&&_6_&&_6_&&_5_&&_7_&&_7_&&_6" | |
492 | - | let roundCourseString = "3N8DnpwTffUEjDXXEsn6btFrbgWC8VZJhTZ_&&_course_1_&&_course_2_&&_green_1_&&_70_&&_110_&&_men_&&_1622640688000_&&_cloudy_&&_11" | |
493 | - | let coursePar = "4_&&_4_&&_4_&&_4_&&_3_&&_5_&&_4_&&_5_&&_6_&&_5_&&_3_&&_5_&&_4_&&_4_&&_5_&&_4_&&_4_&&_4" | |
494 | - | let courseHdcp = "1_&&_2_&&_3_&&_4_&&_5_&&_6_&&_7_&&_8_&&_9_&&_10_&&_11_&&_12_&&_13_&&_14_&&_15_&&_16_&&_17_&&_18" | |
495 | - | let score1 = parseIntList(split(getRoundScore(getRoundCount, currentKey), "_&&_")) | |
496 | - | let score2 = parseIntList(split(getRoundScore((getRoundCount - 1), currentKey), "_&&_")) | |
497 | - | let score3 = parseIntList(split(getRoundScore((getRoundCount - 2), currentKey), "_&&_")) | |
498 | - | let roundCourse1 = split(getRoundCourse(getRoundCount, currentKey), "_&&_") | |
499 | - | let roundCourse2 = split(getRoundCourse((getRoundCount - 1), currentKey), "_&&_") | |
500 | - | let roundCourse3 = split(getRoundCourse((getRoundCount - 2), currentKey), "_&&_") | |
501 | - | let coursePar1 = parseIntList(split(coursePar1Str, "_&&_")) | |
502 | - | let coursePar2 = parseIntList(split(coursePar2Str, "_&&_")) | |
503 | - | let coursePar3 = parseIntList(split(coursePar3Str, "_&&_")) | |
504 | - | let courseHdcp1 = parseIntList(split(courseHdcp1Str, "_&&_")) | |
505 | - | let courseHdcp2 = parseIntList(split(courseHdcp2Str, "_&&_")) | |
506 | - | let courseHdcp3 = parseIntList(split(courseHdcp3Str, "_&&_")) | |
507 | - | let scoreDifferential1 = scoreDifferential(score1, coursePar1, courseHdcp1, parseIntValue(roundCourse1[5]), parseIntValue(roundCourse1[6]), getHandicapIndex) | |
508 | - | let scoreDifferential2 = scoreDifferential(score2, coursePar2, courseHdcp2, parseIntValue(roundCourse2[5]), parseIntValue(roundCourse2[6]), getHandicapIndex) | |
509 | - | let scoreDifferential3 = scoreDifferential(score3, coursePar3, courseHdcp3, parseIntValue(roundCourse3[5]), parseIntValue(roundCourse3[6]), getHandicapIndex) | |
510 | - | let resultHandicapDapp = "3My7znnhd1L35kRQZWXJXZa6PBDfr9oN6Wu" | |
511 | - | let handicapIndex = invoke(addressFromStringValue(resultHandicapDapp), "resultHandicap", [scoreDifferential1, scoreDifferential2, scoreDifferential3, currentKey], nil) | |
512 | - | nil | |
14 | + | func resultHandicap (scoreDifferential1,scoreDifferential2,scoreDifferential3,currentKey) = { | |
15 | + | let scoreDifferentialLowest = max([scoreDifferential1, scoreDifferential2, scoreDifferential3]) | |
16 | + | let result = (scoreDifferentialLowest - 2) | |
17 | + | let handicapIndex = handicapIndexRequirements(result) | |
18 | + | $Tuple2([BooleanEntry("result", true), IntegerEntry((currentKey + "_handicapIndex"), handicapIndex), Reissue(handiId, handicapIndex, false), ScriptTransfer(i.caller, handicapIndex, handiId)], handicapIndex) | |
513 | 19 | } | |
514 | 20 | ||
515 | 21 | ||
516 | 22 | @Verifier(tx) | |
517 | 23 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
518 | 24 |
github/deemru/w8io/026f985 59.82 ms ◑