-
Notifications
You must be signed in to change notification settings - Fork 9
/
scoring-rules.config.js
421 lines (417 loc) · 12.8 KB
/
scoring-rules.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
'use strict';
import * as scoring from './src/scoring.js';
/**
* These are the scoring types
* @enum {object[][]} scoringRules
*
* The differences are mostly in the multipliers and the way the closing distances of the triangles are calculated
*
* These are the tools that are already implemented in scoring.js/geom.js:
* @param {function} closingDistance is the triangle closing type, you choose between two types:
* closingWithLimit - closing distance is limited
* closingWithPenalty - closing distance is unlimited but incurs a penalty
* @param {number} closingDistanceFixed is the fixed closing distance that is always accepted
* @param {number} closingDistanceFree is the closing distance that does not incur any scoring penalty
* @param {number} closingDistanceRelative is the closing distance that is relative to the full triangle length but incurs a penalty
*/
const scoringRules = {
/**
* FFVL Rules
* @constant {object[]}
*/
'FFVL': [
{
name: 'Distance 3 points',
multiplier: 1,
bound: scoring.boundDistance3Points,
score: scoring.scoreDistance3Points,
rounding: round2,
cardinality: 3,
code: 'od'
},
{
name: 'Triangle plat',
multiplier: 1.2,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
closingDistance: scoring.closingWithLimit,
closingDistanceFixed: 3,
closingDistanceFree: 3,
closingDistanceRelative: 0.05,
rounding: round2,
cardinality: 3,
code: 'tri'
},
{
name: 'Triangle FAI',
multiplier: 1.4,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
minSide: 0.28,
closingDistance: scoring.closingWithLimit,
closingDistanceFixed: 3,
closingDistanceFree: 3,
closingDistanceRelative: 0.05,
rounding: round2,
cardinality: 3,
code: 'fai'
}
],
/**
* XContest Rules
* @constant {object[]}
*/
'XContest': [
{
name: 'Free Flight',
multiplier: 1,
bound: scoring.boundDistance3Points,
score: scoring.scoreDistance3Points,
rounding: round2,
cardinality: 3,
code: 'od'
},
{
name: 'Free Triangle',
multiplier: 1.2,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
closingDistance: scoring.closingWithLimit,
closingDistanceRelative: 0.2,
rounding: round2,
cardinality: 3,
code: 'tri'
},
{
name: 'FAI Triangle',
multiplier: 1.4,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
minSide: 0.28,
closingDistance: scoring.closingWithLimit,
closingDistanceRelative: 0.2,
rounding: round2,
cardinality: 3,
code: 'fai'
},
{
name: 'Closed Free Triangle',
multiplier: 1.4,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
closingDistance: scoring.closingWithLimit,
closingDistanceFixed: 0,
closingDistanceFree: 0,
closingDistanceRelative: 0.05,
rounding: round2,
cardinality: 3,
code: 'tri'
},
{
name: 'Closed FAI Triangle',
multiplier: 1.6,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
minSide: 0.28,
closingDistance: scoring.closingWithLimit,
closingDistanceFixed: 0,
closingDistanceFree: 0,
closingDistanceRelative: 0.05,
rounding: round2,
cardinality: 3,
code: 'fai'
}
],
/**
* FAI Scoring Rules w/o cylinders
* @constant {object[]}
*/
'FAI': [
{
name: 'Free Distance around 3 TPs',
multiplier: 1,
bound: scoring.boundDistance3Points,
score: scoring.scoreDistance3Points,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'od'
},
{
name: 'Free Triangle',
multiplier: 1.2,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
closingDistance: scoring.closingWithLimit,
closingDistanceFree: 0.8,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'tri'
},
{
name: 'FAI Triangle',
multiplier: 1.4,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
minSide: 0.28,
closingDistance: scoring.closingWithLimit,
closingDistanceFree: 0.8,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'fai'
}
],
/**
* FAI Scoring Rules w/ cylinders
* @constant {object[]}
*/
'FAI-Cylinders': [
{
name: 'Free Distance around 3 TPs',
multiplier: 1,
bound: scoring.boundDistance3Points,
score: scoring.scoreDistance3Points,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'od',
cylinders: 0.4,
post: scoring.adjustFAICylinders
},
{
name: 'Free Triangle',
multiplier: 1.2,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
closingDistance: scoring.closingWithLimit,
closingDistanceFree: 0.8,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'tri',
cylinders: 0.4,
post: scoring.adjustFAICylinders
},
{
name: 'FAI Triangle',
multiplier: 1.4,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
minSide: 0.28,
closingDistance: scoring.closingWithLimit,
closingDistanceFree: 0.8,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'fai',
cylinders: 0.4,
post: scoring.adjustFAICylinders
}
],
/**
* FAI Out-and-Return Distance evaluation w/o scoring multiplier
* @constant {object[]}
*/
'FAI-OAR': [
{
/**
* This is the FAI definition of Out-and-Return Distance
* with a single TP
*/
name: 'Out-and-Return Distance',
multiplier: 1,
bound: scoring.boundOutAndReturn1,
score: scoring.scoreOutAndReturn1,
closingDistance: scoring.closingWithLimit,
closingDistanceFree: 0.8,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'oar'
}
],
/**
* FAI Out-and-Return Distance around 2 TPs w/o scoring multiplier
* @constant {object[]}
*/
'FAI-OAR2': [
{
/**
* This type of flight is very similar to XCLeague
* Out-and-Return distance
*/
name: 'Out-and-Return Flight around 2 TPs',
multiplier: 1,
bound: scoring.boundOutAndReturn2,
score: scoring.scoreOutAndReturn2,
closingDistance: scoring.closingWithLimit,
closingDistanceFree: 0.8,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 2,
code: 'oar'
}
],
/**
* XCLeague Rules
* @constant {object[]}
*/
'XCLeague': [
{
/**
* This is the XCLeague definition of Out-and-Return Distance
* between 2 turnpoints
*/
name: 'Out-and-Return Distance >=35km',
multiplier: 2,
bound: scoring.boundOutAndReturn2,
score: scoring.scoreOutAndReturn2,
closingDistance: scoring.closingWithLimit,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 2,
code: 'oar',
minDistance: 35
},
{
name: 'Out-and-Return Distance >=15km',
multiplier: 1.5,
bound: scoring.boundOutAndReturn2,
score: scoring.scoreOutAndReturn2,
closingDistance: scoring.closingWithLimit,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 2,
code: 'oar',
minDistance: 15
},
{
name: 'Out-and-Return Distance >=5km (Clubs)',
multiplier: 1.2,
bound: scoring.boundOutAndReturn2,
score: scoring.scoreOutAndReturn2,
closingDistance: scoring.closingWithLimit,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 2,
code: 'oar',
minDistance: 5
},
{
name: 'Turnpoint Flight',
multiplier: 1,
bound: scoring.boundDistance3Points,
score: scoring.scoreDistance3Points,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'od',
minDistance: 5
},
{
name: 'Flat Triangle >=35km',
multiplier: 2,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
minSide: 0.15,
maxSide: 0.45,
closingDistance: scoring.closingWithLimit,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'tri',
minDistance: 35
},
{
name: 'Flat Triangle >=15km',
multiplier: 1.5,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
minSide: 0.15,
maxSide: 0.45,
closingDistance: scoring.closingWithLimit,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'tri',
minDistance: 15
},
{
name: 'Flat Triangle >=5km (Clubs)',
multiplier: 1.2,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
minSide: 0.15,
maxSide: 0.45,
closingDistance: scoring.closingWithLimit,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'tri',
minDistance: 5
},
{
name: 'FAI Triangle >=25km',
multiplier: 2.3,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
minSide: 0.28,
closingDistance: scoring.closingWithLimit,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'tri',
minDistance: 25
},
{
name: 'FAI Triangle >=15km',
multiplier: 2,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
minSide: 0.28,
closingDistance: scoring.closingWithLimit,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'tri',
minDistance: 15
},
{
name: 'FAI Triangle >=5km (Clubs)',
multiplier: 1.5,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
minSide: 0.28,
closingDistance: scoring.closingWithLimit,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'tri',
minDistance: 5
}
]
};
function round2(score) {
return parseFloat(parseFloat(score).toFixed(2));
}
function round1(score) {
return parseFloat(parseFloat(score).toFixed(1));
}
export default scoringRules;