{"id":16701759,"url":"https://github.com/mrdimosthenis/glicko2","last_synced_at":"2025-10-30T01:35:47.912Z","repository":{"id":57721625,"uuid":"458901256","full_name":"mrdimosthenis/glicko2","owner":"mrdimosthenis","description":"The Glicko-2 rating system for Scala and Scala.js","archived":false,"fork":false,"pushed_at":"2022-10-25T16:43:43.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T06:42:00.791Z","etag":null,"topics":["glicko","glicko-2","glicko-calculator","glicko-rating","glicko-ratings","glicko2","glicko2-algorithm","rating","rating-prediction","rating-system","ratings","scala","scalajs"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrdimosthenis.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-13T18:52:17.000Z","updated_at":"2023-03-28T09:21:26.000Z","dependencies_parsed_at":"2023-01-20T14:32:12.825Z","dependency_job_id":null,"html_url":"https://github.com/mrdimosthenis/glicko2","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mrdimosthenis/glicko2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdimosthenis%2Fglicko2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdimosthenis%2Fglicko2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdimosthenis%2Fglicko2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdimosthenis%2Fglicko2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrdimosthenis","download_url":"https://codeload.github.com/mrdimosthenis/glicko2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrdimosthenis%2Fglicko2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271363904,"owners_count":24746789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["glicko","glicko-2","glicko-calculator","glicko-rating","glicko-ratings","glicko2","glicko2-algorithm","rating","rating-prediction","rating-system","ratings","scala","scalajs"],"created_at":"2024-10-12T18:45:30.163Z","updated_at":"2025-10-30T01:35:42.892Z","avatar_url":"https://github.com/mrdimosthenis.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# glicko2\n\nAn implementation of the **Glicko-2** rating system for **Scala** and **Scala.js**.\n\n## Install the library\n\nAdd the dependency in the `build.sbt` file.\n\n```scala\nlibraryDependencies += \"com.github.mrdimosthenis\" %% \"glicko2\" % \"1.0.1\"\n```\n\nFor Scala.js use the `%%%` operator instead of `%%`.\n\n## Import the package\n\n```scala\nimport dimos.glicko2._\n```\n\n## Create players\n\n`Player` is a case class with three parameters (`rating`, `deviation`, `volatility`).\n\n* We can create a player by defining their parameters.\n```scala\nval player = Player(1464, 151, 0.06)\n```\n\n* We can also create a player with the default initial parameters.\n```scala\nval newPlayer = Player.newEntry()\n// Player(1500.0, 350.0, 0.06)\n```\n\n## Create results\n\n`Result` is an enum with three values (`WonAgainst`, `DefeatedBy`, `TiedWith`).\n\nTo create results, we need to specify their kind, their opponent and place them inside a `Seq`.\n```scala\nval res = List(Result.WonAgainst(newPlayer))\n```\n\n## Calculate player params after a period of results\n\nWe can see how results affect a player.\n```scala\nval playerUpdated = player.afterPeriod(res)\n// Player(1507.5, 145.3, 0.06)\n```\n\n## Glickman's example\n\nSuppose a player rated `1500` competes against players rated `1400`, `1550` and `1700`, winning\nthe first game and losing the next two. Assume the `1500`-rated player’s rating deviation\nis `200`, and his opponents’ are `30`, `100` and `300`, respectively. Assume the `1500` player has\nvolatility _σ_ = `0.06`, and his opponents have `0.07`, `0.08` and `0.05`, respectively.\n\nLet's see how this example is translated and what happens to the first player when the period ends.\n```scala\nval p = Player(1500, 200, 0.06)\nval opp1 = Player(1400, 30, 0.07)\nval opp2 = Player(1550, 100, 0.08)\nval opp3 = Player(1700, 300, 0.05)\nval res1 = Result.WonAgainst(opp1)\nval res2 = Result.DefeatedBy(opp2)\nval res3 = Result.DefeatedBy(opp3)\nval results = List(res1, res2, res3)\nval pUpdated = p.afterPeriod(results)\n// Player(1464.06, 151.52, 0.05999)\n```\n\n## Tuning\n\nIf the default values of the system do not serve us well, we can change them.\n```scala\nval tuning = Tuning.default(initRating = 1200, minDeviation = 30, tau = 0.75)\n// Tuning(1200.0, 350.0, 30.0, 0.06, 0.75, 0.000001)\n```\n\nIn that case, we need to pass `tuning` as a parameter to `newEntry` and `afterPeriod` functions.\n\nThese are the parameters of `Tuning` and their default values:\n* `initRating`: 1500\n* `maxDeviation`: 350,\n* `minDeviation`: 0,\n* `initVolatility`: 0.06\n* `tau`: 0.5\n* `tolerance`: 0.000001\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrdimosthenis%2Fglicko2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrdimosthenis%2Fglicko2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrdimosthenis%2Fglicko2/lists"}