Code center > Darwinbots3

DB3 Leagues

<< < (6/9) > >>

Panda:
We don't know the elo of each of the 10000 players when we're trying to simulate that, unless we just assume they're all new?

Peter:
There's need of some boilerplate code to keep track of all players.

Btw, I'm curious how well Elo/TrueSkill/Glicko/win% compare when matches are picked at random.

Panda:
Yeah, there is boilerplate code for it but I'm just trying to work out how to do it.

Each of these systems are designed so that matches are picked at random, aren't they? You basically want to take a small sample that represents the global population.

Peter:

--- Quote from: Panda on April 12, 2015, 11:51:14 AM ---Each of these systems are designed so that matches are picked at random, aren't they? You basically want to take a small sample that represents the global population.

--- End quote ---
They're not. Otherwise a chess grandmaster has to play a low ranked player often. They're designed to calculate the right strength of players. Including on how to deal with matches not being a random sample.

Edit: I was playing around with TrueSkill. And the library I took even has issues with high vs. low ranked players. Calculating skill as NaN in some cases...

edit2:

--- Code: ---using System;
using System.Collections.Generic;
using Moserware.Skills;
using System.Diagnostics;

namespace TrueSkillTest
{
    class Program
    {
        static void Main(string[] args)
        {
            GameInfo defaultInfo = GameInfo.DefaultGameInfo;
            List<BotPlayer> botPlayers = new List<BotPlayer>();
           
            for (int i = 0; i < 10; i++)
            {
                var newb = new BotPlayer(i);
                newb.rating = defaultInfo.DefaultRating;
                botPlayers.Add(newb);

            }
            var random = new Random(1234);
            for (int i = 0; i < 250; i++)
            {
                int id1 = random.Next(10);
                int id2 = random.Next(10);
                if (id1 == id2)
                    continue;
           if (id1>id2)
           {
               int switchId = id1;
               id1=id2;
               id2=switchId;
           }

           var team1 = new Team(botPlayers[id1], botPlayers[id1].rating);
           var team2 = new Team(botPlayers[id2], botPlayers[id2].rating);
            var teams = Teams.Concat(team1, team2);
           
            var results = TrueSkillCalculator.CalculateNewRatings(defaultInfo, teams,1,2);
            if (results[botPlayers[id2]].ConservativeRating.Equals(double.NaN) || results[botPlayers[id1]].ConservativeRating.Equals(double.NaN))
            {
                Debug.WriteLine("NaN happened  "+id1   +" "+id2);
                continue;
            }
            botPlayers[id2].rating = results[botPlayers[id2]];
            botPlayers[id1].rating = results[botPlayers[id1]];
            botPlayers[id1].wins++;
            botPlayers[id2].losses++;
            botPlayers[id1].games++;
            botPlayers[id2].games++;
            }

            Debug.WriteLine( "id \t ConservativeRating  \t  Mean \t\t  StandardDeviation  \t win% ");

            for (int i = 0; i < 10; i++)
            {
                var rat = botPlayers[i].rating;
                Debug.WriteLine(i + "\t" + rat.ConservativeRating + "\t" + rat.Mean + "\t" + rat.StandardDeviation + "\t" + ((float)botPlayers[i].wins / (float) botPlayers[i].games)*100 +"% ");
            }

        }
    }

    public class BotPlayer : Player
    {
        public Rating rating;
        public int games, wins, losses;

        public BotPlayer(int i)
            :base(i)
        {
        }

    }

}

--- End code ---

TrueSkill ratings and win% after 250 random matches.

Player with id 0>1>2>3 etc.

id     ConservativeRating       Mean         StandardDeviation      win%
0   36.6018093613847   44.3298552173074   2.57601528530759   100%
1   32.3380042534196   39.2166471449276   2.29288096383602   91.42857%
2   32.2120554191209   38.422586286346   2.07017695574173   89.58334%
3   24.4339328188783   29.6447006659815   1.73692261570105   50.9434%
4   23.2533477507645   29.1590048994883   1.96855238290791   68.18182%
5   18.3016520660433   23.4776208283092   1.72532292075527   44.64286%
6   13.2212442413914   19.1699259868905   1.98289391516637   26.82927%
7   10.0415863402407   15.7679791596343   1.90879760646453   25%
8   4.18826635383718   10.6105575553436   2.14076373383547   10.41667%
9   -2.27059972504378   4.86224661720219   2.37761544741532   0%

edit: RPC, TrueSkill same amount of matches
Major strategy is Scissor. Paper and Rock as minor strategies. As you can see the minor strategy beating the major tactic does take place.

Rock Paper Scissor
id     ConservativeRating    Mean            StandardDeviation      win%      games
0   22.2911857672074   25.635469626594   1.11476128646221     29.54545%    44  Scissor
1   21.7841748039772   25.0038555837073   1.07322692657669     17.77778%    45  Scissor
2   19.0423325347074   22.3747330556796   1.11080017365737     26.92308%    52  Paper
3   24.8168168325261   28.5840867091271   1.25575662553368     68.88889%    45  Rock
4   22.2261144113132   25.2695586097977   1.01448139949485     23.07692%    52  Scissor
5   21.3862248458399   24.6455366523104   1.08643726882351     15.55556%    45  Scissor
6   20.652998113402   24.0505831870944   1.13252835789746     11.62791%    43 Scissor
7   17.4614961926684   21.3511453077313   1.29654970502095     20%    40  Paper
8   22.4296910660544   25.6949142849584   1.08840773963469     34%    50  Scissor
9   24.2526401114872   28.2686183545096   1.3386594143408     71.42857%    42  Rock

Numsgil:

--- Quote from: Peter on April 12, 2015, 01:10:18 PM ---edit: RPC, TrueSkill same amount of matches
Major strategy is Scissor. Paper and Rock as minor strategies. As you can see the minor strategy beating the major tactic does take place.

Rock Paper Scissor
id     ConservativeRating    Mean            StandardDeviation      win%      games
0   22.2911857672074   25.635469626594   1.11476128646221     29.54545%    44  Scissor
1   21.7841748039772   25.0038555837073   1.07322692657669     17.77778%    45  Scissor
2   19.0423325347074   22.3747330556796   1.11080017365737     26.92308%    52  Paper
3   24.8168168325261   28.5840867091271   1.25575662553368     68.88889%    45  Rock
4   22.2261144113132   25.2695586097977   1.01448139949485     23.07692%    52  Scissor
5   21.3862248458399   24.6455366523104   1.08643726882351     15.55556%    45  Scissor
6   20.652998113402   24.0505831870944   1.13252835789746     11.62791%    43 Scissor
7   17.4614961926684   21.3511453077313   1.29654970502095     20%    40  Paper
8   22.4296910660544   25.6949142849584   1.08840773963469     34%    50  Scissor
9   24.2526401114872   28.2686183545096   1.3386594143408     71.42857%    42  Rock

--- End quote ---

Looks like it places them all around the same skill?  I think that's what we'd want if so.  It's hard to get a sense of the relative scales.    Can you add in a strategy that has a 80% chance to win against any of RPS?  I'd like to see if it's noticeably higher than all the others.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version