INNER CODE UNIT · TypeScript

setCount

ekzhang/setwithfriends · functions/src/index.ts:174

  const setCount = Object.values(scores).reduce((a, b) => a + b);
  for (const player of players) {
    achievedRatio[player] = scores[player] / setCount;
  }

  // Compute new rating for each player.
  const updates: Record<string, number> = {};
  for (const player of players) {
    /**
     * Adapt the learning rate to the experience of a player and the
     * corresponding certainty of the rating system based on the number of
     * games played.
     */
    const gameCount = userStats[player].finishedGames as number;
    const learningRate = Math.max(256 / (1 + gameCount / 20), 64);

    const newRating =
      ratings[player] +

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…