@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 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-canary.544.e3791e4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/elo@7.18.1...@quenty/elo@7.18.2-canary.544.e3791e4.0) (2025-03-29)
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-canary.544.e3791e4.0",
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-canary.544.e3791e4.0",
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": "e3791e4f59d16284550b15bbda6c819c58496378"
39
+ "gitHead": "af926ec08f523833f37d22477c72dca034219823"
40
40
  }
@@ -3,77 +3,72 @@
3
3
  @class EloUtils.spec.lua
4
4
  ]]
5
5
 
6
- local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
7
-
8
- local EloUtils = require("EloUtils")
9
- local Jest = require("Jest")
10
-
11
- local describe = Jest.Globals.describe
12
- local expect = Jest.Globals.expect
13
- local it = Jest.Globals.it
14
-
15
- describe("EloUtils.getNewElo", function()
16
- local config = EloUtils.createConfig()
17
-
18
- local playerRating = 1400
19
- local opponentRating = 1800
20
-
21
- local newPlayerWinRating, newOpponentWinRating
22
- local newPlayerLossRating, newOpponentLossRating
23
- local newPlayerDrawRating, newOpponentDrawRating
24
-
25
- it("should change on win", function()
26
- newPlayerWinRating, newOpponentWinRating = EloUtils.getNewElo(
27
- config,
28
- playerRating,
29
- opponentRating,
30
- {
31
- EloUtils.MatchResult.PLAYER_ONE_WIN;
32
- })
33
-
34
- expect(newPlayerWinRating > playerRating).to.equal(true)
35
- expect(newOpponentWinRating < opponentRating).to.equal(true)
36
- end)
37
-
38
- it("should change on a loss", function()
39
- newPlayerLossRating, newOpponentLossRating = EloUtils.getNewElo(
40
- config,
41
- playerRating,
42
- opponentRating,
43
- {
44
- EloUtils.MatchResult.PLAYER_TWO_WIN;
45
- })
46
-
47
- expect(newPlayerLossRating < playerRating).to.equal(true)
48
- expect(newOpponentLossRating > opponentRating).to.equal(true)
49
- end)
50
-
51
- it("should change on a draw", function()
52
- newPlayerDrawRating, newOpponentDrawRating = EloUtils.getNewElo(
53
- config,
54
- playerRating,
55
- opponentRating,
56
- {
57
- EloUtils.MatchResult.DRAW;
58
- })
59
-
60
- expect(newPlayerDrawRating > playerRating).to.equal(true)
61
- expect(newOpponentDrawRating < opponentRating).to.equal(true)
62
- end)
63
-
64
- it("should change more on an unexpected win then a loss", function()
65
- local winChange = math.abs(playerRating - newPlayerWinRating)
66
- local drawChange = math.abs(playerRating - newPlayerDrawRating)
67
- local lossChange = math.abs(playerRating - newPlayerLossRating)
68
-
69
- expect(winChange > lossChange).to.equal(true)
70
- expect(winChange > drawChange ).to.equal(true)
71
- expect(drawChange > lossChange).to.equal(true)
72
- end)
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