Skip to content

Commit 4f34b0d

Browse files
committed
Adjust basketball team ovr for numPlayersOnCourt
1 parent f5473bf commit 4f34b0d

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

TODO

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
GOAT lab and GOAT season date range filters https://discord.com/channels/290013534023057409/331882115119448065/1327680226477604895
22
- for players, implement similar to Advanced Player Search
33

4-
basketball team ovr should adjust for numPlayersOnCourt https://mail.google.com/mail/u/0/#inbox/FMfcgzQXKhJZvwmSjwbthGLcdXGfCrJH
5-
64
on drive chart, a 2 point conversion attempt that goes backwards puts the end of the score tag on the wrong side of the field
75

86
trading block picks filter should also include negative value players if that allows another pick or a better pick to be included

src/worker/core/team/ovr.basketball.ts

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { g } from "../../util";
2+
13
const ovr = (
24
players: {
35
ratings: {
@@ -45,18 +47,40 @@ const ovr = (
4547
b = -0.1609;
4648
k = 102.98;
4749
}
48-
const predictedMOV =
49-
-k +
50-
a * Math.exp(b * 0) * ratings[0] +
51-
a * Math.exp(b * 1) * ratings[1] +
52-
a * Math.exp(b * 2) * ratings[2] +
53-
a * Math.exp(b * 3) * ratings[3] +
54-
a * Math.exp(b * 4) * ratings[4] +
55-
a * Math.exp(b * 5) * ratings[5] +
56-
a * Math.exp(b * 6) * ratings[6] +
57-
a * Math.exp(b * 7) * ratings[7] +
58-
a * Math.exp(b * 8) * ratings[8] +
59-
a * Math.exp(b * 9) * ratings[9];
50+
51+
const numPlayersOnCourt = g.get("numPlayersOnCourt");
52+
let predictedMOV;
53+
if (numPlayersOnCourt >= 5) {
54+
predictedMOV =
55+
-k +
56+
a * Math.exp(b * 0) * ratings[0] +
57+
a * Math.exp(b * 1) * ratings[1] +
58+
a * Math.exp(b * 2) * ratings[2] +
59+
a * Math.exp(b * 3) * ratings[3] +
60+
a * Math.exp(b * 4) * ratings[4] +
61+
a * Math.exp(b * 5) * ratings[5] +
62+
a * Math.exp(b * 6) * ratings[6] +
63+
a * Math.exp(b * 7) * ratings[7] +
64+
a * Math.exp(b * 8) * ratings[8] +
65+
a * Math.exp(b * 9) * ratings[9];
66+
} else {
67+
predictedMOV = -k;
68+
69+
let ratingsIndex = 0;
70+
for (let i = 0; i < numPlayersOnCourt; i++) {
71+
predictedMOV += a * Math.exp(b * i) * ratings[ratingsIndex];
72+
ratingsIndex += 1;
73+
}
74+
75+
// Skip the coefficients of the normal starters who are now bench players
76+
for (let i = 5; i < 10; i++) {
77+
predictedMOV += a * Math.exp(b * i) * ratings[ratingsIndex];
78+
ratingsIndex += 1;
79+
}
80+
81+
// Rough estimates to keep ovr on 0-100 scale
82+
predictedMOV += (60 * (5 - numPlayersOnCourt)) / 5;
83+
}
6084

6185
if (rating) {
6286
// In this case, we're ultimately using the value to compute a rank or some other relative score, so we don't care about the scale

0 commit comments

Comments
 (0)