forked from lichess-org/scalachess
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Foundation for rating color advantage test (WIP)
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
test-kit/src/test/scala/rating/glicko/GlickoCalculatorWithColorAdvantageTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package chess | ||
package rating | ||
package glicko | ||
|
||
class GlickoCalculatorWithColorAdvantageTest extends ChessTest: | ||
|
||
import Outcome.* | ||
|
||
private def ratingDiff(r: Int, opRating: Int, outcome: Outcome, expected: Int)(using | ||
munit.Location | ||
) = | ||
val player = Player(Glicko(r, 1d, 1d)) | ||
val opponent = Player(Glicko(opRating, 1d, 1d)) | ||
val game = Game(ByColor(player, opponent), outcome) | ||
// TODO: calculator with color advantage | ||
val calculator = GlickoCalculator() | ||
calculator.computeGame(game) | ||
|
||
test("new rating calculation over one game"): | ||
ratingDiff(1500, 1500, white, 20) | ||
ratingDiff(1500, 1500, black, -20) | ||
ratingDiff(1500, 1500, draw, 0) | ||
ratingDiff(1500, 1900, white, 37) | ||
ratingDiff(1500, 1900, black, -3) | ||
ratingDiff(1500, 1900, draw, 17) | ||
ratingDiff(1500, 2900, white, 37) | ||
ratingDiff(1500, 2900, black, -3) | ||
ratingDiff(1500, 2900, draw, 17) | ||
ratingDiff(1500, 1600, white, 26) | ||
ratingDiff(1500, 1600, black, -14) | ||
ratingDiff(1500, 1600, draw, 6) | ||
ratingDiff(2000, 1600, white, 3) | ||
ratingDiff(2000, 1600, black, -37) | ||
ratingDiff(2000, 1600, draw, -17) | ||
ratingDiff(2000, 1000, white, 3) | ||
ratingDiff(2000, 1000, black, -37) | ||
ratingDiff(2000, 1000, draw, -17) | ||
ratingDiff(2000, 1900, white, 14) | ||
ratingDiff(2000, 1900, black, -26) | ||
ratingDiff(2000, 1900, draw, -6) |