@quenty/elo 7.18.2-canary.544.e3791e4.0 → 7.18.2
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/CHANGELOG.md +1 -1
- package/package.json +6 -6
- package/src/Shared/EloUtils.spec.lua +68 -73
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [7.18.2
|
|
6
|
+
## [7.18.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/elo@7.18.1...@quenty/elo@7.18.2) (2025-03-31)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @quenty/elo
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/elo",
|
|
3
|
-
"version": "7.18.2
|
|
3
|
+
"version": "7.18.2",
|
|
4
4
|
"description": "Elo rating utility library.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@quenty/blend": "12.17.2
|
|
33
|
-
"@quenty/loader": "10.8.0",
|
|
34
|
-
"@quenty/maid": "3.4.0"
|
|
32
|
+
"@quenty/blend": "^12.17.2",
|
|
33
|
+
"@quenty/loader": "^10.8.0",
|
|
34
|
+
"@quenty/maid": "^3.4.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@quenty/probability": "2.3.1"
|
|
37
|
+
"@quenty/probability": "^2.3.1"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "af926ec08f523833f37d22477c72dca034219823"
|
|
40
40
|
}
|
|
@@ -3,77 +3,72 @@
|
|
|
3
3
|
@class EloUtils.spec.lua
|
|
4
4
|
]]
|
|
5
5
|
|
|
6
|
-
local
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
local
|
|
13
|
-
local
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
playerRating
|
|
29
|
-
opponentRating
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
playerRating
|
|
42
|
-
opponentRating
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
playerRating
|
|
55
|
-
opponentRating
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
it("should compute percentile as 0.5", function()
|
|
75
|
-
local percentile = EloUtils.getPercentile(config, 1400)
|
|
76
|
-
|
|
77
|
-
expect(percentile).to.equal(0.5)
|
|
6
|
+
local EloUtils = require(script.Parent.EloUtils)
|
|
7
|
+
|
|
8
|
+
return function()
|
|
9
|
+
describe("EloUtils.getNewElo", function()
|
|
10
|
+
local config = EloUtils.createConfig()
|
|
11
|
+
|
|
12
|
+
local playerRating = 1400
|
|
13
|
+
local opponentRating = 1800
|
|
14
|
+
|
|
15
|
+
local newPlayerWinRating, newOpponentWinRating
|
|
16
|
+
local newPlayerLossRating, newOpponentLossRating
|
|
17
|
+
local newPlayerDrawRating, newOpponentDrawRating
|
|
18
|
+
|
|
19
|
+
it("should change on win", function()
|
|
20
|
+
newPlayerWinRating, newOpponentWinRating = EloUtils.getNewElo(
|
|
21
|
+
config,
|
|
22
|
+
playerRating,
|
|
23
|
+
opponentRating,
|
|
24
|
+
{
|
|
25
|
+
EloUtils.MatchResult.PLAYER_ONE_WIN;
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
expect(newPlayerWinRating > playerRating).to.equal(true)
|
|
29
|
+
expect(newOpponentWinRating < opponentRating).to.equal(true)
|
|
30
|
+
end)
|
|
31
|
+
|
|
32
|
+
it("should change on a loss", function()
|
|
33
|
+
newPlayerLossRating, newOpponentLossRating = EloUtils.getNewElo(
|
|
34
|
+
config,
|
|
35
|
+
playerRating,
|
|
36
|
+
opponentRating,
|
|
37
|
+
{
|
|
38
|
+
EloUtils.MatchResult.PLAYER_TWO_WIN;
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
expect(newPlayerLossRating < playerRating).to.equal(true)
|
|
42
|
+
expect(newOpponentLossRating > opponentRating).to.equal(true)
|
|
43
|
+
end)
|
|
44
|
+
|
|
45
|
+
it("should change on a draw", function()
|
|
46
|
+
newPlayerDrawRating, newOpponentDrawRating = EloUtils.getNewElo(
|
|
47
|
+
config,
|
|
48
|
+
playerRating,
|
|
49
|
+
opponentRating,
|
|
50
|
+
{
|
|
51
|
+
EloUtils.MatchResult.DRAW;
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
expect(newPlayerDrawRating > playerRating).to.equal(true)
|
|
55
|
+
expect(newOpponentDrawRating < opponentRating).to.equal(true)
|
|
56
|
+
end)
|
|
57
|
+
|
|
58
|
+
it("should change more on an unexpected win then a loss", function()
|
|
59
|
+
local winChange = math.abs(playerRating - newPlayerWinRating)
|
|
60
|
+
local drawChange = math.abs(playerRating - newPlayerDrawRating)
|
|
61
|
+
local lossChange = math.abs(playerRating - newPlayerLossRating)
|
|
62
|
+
|
|
63
|
+
expect(winChange > lossChange).to.equal(true)
|
|
64
|
+
expect(winChange > drawChange ).to.equal(true)
|
|
65
|
+
expect(drawChange > lossChange).to.equal(true)
|
|
66
|
+
end)
|
|
67
|
+
|
|
68
|
+
it("should compute percentile as 0.5", function()
|
|
69
|
+
local percentile = EloUtils.getPercentile(config, 1400)
|
|
70
|
+
|
|
71
|
+
expect(percentile).to.equal(0.5)
|
|
72
|
+
end)
|
|
78
73
|
end)
|
|
79
|
-
end
|
|
74
|
+
end
|