Welcome, Guest. Please Login or Register.
May 19th, 2024, 1:03pm

Home Home Help Help Search Search Members Members Login Login Register Register
Arimaa Forum « Rate evolution curve and statistics ? »


   Arimaa Forum
   Arimaa
   Site Discussion
(Moderator: supersamu)
   Rate evolution curve and statistics ?
« Previous topic | Next topic »
Pages: 1 2  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Rate evolution curve and statistics ?  (Read 3236 times)
pago
Forum Guru
*****



Arimaa player #5439

   
Email

Gender: male
Posts: 69
Rate evolution curve and statistics ?
« on: Jul 17th, 2010, 7:10am »
Quote Quote Modify Modify


Hello,
 
As far as I know Arimaa site only allows to know the current ELO rate of a player.
 
Wouldn't it be possible to get a curve showing the evolution of a player during a period (for example the last two years) and other kind of statistics (for example the histogram of all player rate)
IP Logged
rbarreira
Forum Guru
*****



Arimaa player #1621

   


Gender: male
Posts: 605
Re: Rate evolution curve and statistics ?
« Reply #1 on: Jul 17th, 2010, 7:51am »
Quote Quote Modify Modify

It would definitely be possible because the game history contains the rating for both players before that game. So this data exists in the site's database.
 
Whether it will happen soon or not, I don't know. It's definitely a cool idea though.
 
If omar needs volunteers for certain programming tasks like this one, I might try helping (with no guarantees as to when it would be finished).
IP Logged
ocmiente
Forum Guru
*****




Arimaa player #3996

   
WWW

Gender: male
Posts: 194
Re: Rate evolution curve and statistics ?
« Reply #2 on: Jul 17th, 2010, 7:57am »
Quote Quote Modify Modify

It is certainly possible, and I would like to see that on the site as well.  
 
In the meantime, you can get these statistics for yourself by downloading the game history files and extracting the data you need.  I wanted to see my rating history recently, and did that.  
 
If you have a C# compiler, you might be able to use the same code I wrote:
 
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
 
namespace ConsoleApplication1
{
 class Program
 {
  static void Main(string[] args)
  {
   string user = "user_id";
   string directory = "C:\\location\\of\\arimaa\\game\\files";
   DirectoryInfo di = new DirectoryInfo(directory);
   FileInfo[] rgFiles = di.GetFiles("*.txt");
 
   StreamWriter outFile = new StreamWriter(directory + "\\Summary.txt");
 
   foreach (FileInfo fi in rgFiles)
   {
    FileStream file = new FileStream(fi.FullName, FileMode.Open, FileAccess.Read);
    StreamReader sr = new StreamReader(file);
    while (!sr.EndOfStream)
    {
     string line = sr.ReadLine();
     if (line.Contains(user))
     {
      string[] substrings = line.Split('\t');
      int rating = 0;
      if (substrings[3].Equals(user))
      {
       rating = System.Convert.ToInt32(substrings[9]);
      }
      if (substrings[4].Equals(user))
      {
       rating = System.Convert.ToInt32(substrings[10]);
      }
 
      string timestamp = (substrings[27].Split('['))[0];
 
      outFile.WriteLine(rating + "," + timestamp);
     }
    }
    file.Close();
   }
 
   outFile.Close();
  }
 }
}

 
The 'user_id' string, and the 'C:\\location\\of\\arimaa\\game\\files' string have to be changed for this to work.  Output is csv to the Summary.txt file, which I imported into Excel to get the graphs I wanted.   For what I wanted, the code seemed to work, but I don't provide any warranties Smiley
 
Also, the Excel formula for converting the time stamp to a date is:
Code:
=(((B1/60)/60)/24)+DATE(1970,1,1)+(-5/24)

where 'B1' is the cell that contains the time stamp.  
 
The other trick is to get the graph to use the dates as the x axis data.  That isn't very straightforward, but it is possible.
« Last Edit: Jul 17th, 2010, 8:11am by ocmiente » IP Logged

omar
Forum Guru
*****



Arimaa player #2

   


Gender: male
Posts: 1003
Re: Rate evolution curve and statistics ?
« Reply #3 on: Jul 20th, 2010, 4:54pm »
Quote Quote Modify Modify

I had experimented with this a bit, but never got around to finishing it.
 
You can see what I have here:
http://arimaa.com/arimaa/gameroom/graphRatings.htm
 
It uses this web service to get the rating history:
http://arimaa.com/arimaa/gameroom/playerRatingHist.cgi?u=omar
 
You can replace 'omar' with other usernames to get that users rating history. It returns a JSON encoded string which is easy to work with in JavaScript.
 
u - username
rh - rating history array with each element having:
r - rating
id - game id
t - unix timestamp of game end time
 
The data was then graphed using some SVG libraries I found.
 
If anyone wants to try building on this, feel free to use the web service to get the data.
IP Logged
rbarreira
Forum Guru
*****



Arimaa player #1621

   


Gender: male
Posts: 605
Re: Rate evolution curve and statistics ?
« Reply #4 on: Jul 23rd, 2010, 12:22am »
Quote Quote Modify Modify

I can now use omar's web service + a small program I hacked together + Excel to chart a player's rating history throughout time.
 
For example, Fritzlein's chart:
 

 
chessandgo:
 

 
bot_marwin:
 

 
If anyone is interested in a particular user's chart I can post it here.
 
I'll try to get this working on php later on to provide a graph generator online.
« Last Edit: Jul 23rd, 2010, 12:39am by rbarreira » IP Logged
Fritzlein
Forum Guru
*****



Arimaa player #706

   
Email

Gender: male
Posts: 5928
Re: Rate evolution curve and statistics ?
« Reply #5 on: Jul 23rd, 2010, 12:42am »
Quote Quote Modify Modify

Sweet.  If that tool were available online I would definitely use it.
 
I might opt for a scatter plot instead of a line graph, though, with a dot for each game played, so that long periods of inactivity look like gaps rather than ropes.
IP Logged

rbarreira
Forum Guru
*****



Arimaa player #1621

   


Gender: male
Posts: 605
Re: Rate evolution curve and statistics ?
« Reply #6 on: Jul 23rd, 2010, 12:45am »
Quote Quote Modify Modify

I added your chart and chessandgo's to the post. I'll try different kinds of charts later Smiley
IP Logged
Tuks
Forum Guru
*****



Arimaa player #2626

   


Gender: male
Posts: 203
Re: Rate evolution curve and statistics ?
« Reply #7 on: Jul 23rd, 2010, 6:47am »
Quote Quote Modify Modify

can you post mine plz?
IP Logged
Hippo
Forum Guru
*****




Arimaa player #4450

   


Gender: male
Posts: 883
Re: Rate evolution curve and statistics ?
« Reply #8 on: Jul 23rd, 2010, 7:46am »
Quote Quote Modify Modify

on Jul 23rd, 2010, 6:47am, Tuks wrote:
can you post mine plz?

Me too Smiley
IP Logged

rbarreira
Forum Guru
*****



Arimaa player #1621

   


Gender: male
Posts: 605
Re: Rate evolution curve and statistics ?
« Reply #9 on: Jul 23rd, 2010, 9:12am »
Quote Quote Modify Modify

Tuks:
 

 
Hippo:
 
IP Logged
Eltripas
Forum Guru
*****




Meh-he-kah-naw

   


Gender: male
Posts: 225
Re: Rate evolution curve and statistics ?
« Reply #10 on: Jul 23rd, 2010, 12:30pm »
Quote Quote Modify Modify

Do want, please.
IP Logged
Hippo
Forum Guru
*****




Arimaa player #4450

   


Gender: male
Posts: 883
Re: Rate evolution curve and statistics ?
« Reply #11 on: Jul 23rd, 2010, 12:36pm »
Quote Quote Modify Modify

Thanks ... seems to me it would be only small challenge for some our players (... leo?) to make link available to generate such graphs to .png.
Incorporate it to player Pages would be interesting.
 
on Jul 23rd, 2010, 12:30pm, Eltripas wrote:
Do want, please.

Yes especially your graph is one I want to see ... there should be visible kickoff started by our first game this January.
 
on Jul 20th, 2010, 4:54pm, omar wrote:
I had experimented with this a bit, but never got around to finishing it.
 
You can see what I have here:
http://arimaa.com/arimaa/gameroom/graphRatings.htm

Yes the time coordinate replacing the game number is a big improvement. Just to incorporate the automatic generation (with isolated points as proposed by Fritz).
 
I have read the javascripts under graphRatings.htm. Especially wz_graphics.js is very helpfull. I would change line.js to make another kind of graph. It would plot just points in time coordinate and rating coordinate. So the interface giving both coordinates to the graph should be changed as well.
 
I am not used to javascript but something like:
Code:

/*
 
graph.js
 
This package is free software.
It is distributed under GPL - legalese removed,
it means that you can use this for any purpose,
but cannot charge for this software.
Any enhancements you make to this piece of code,
should be made available free to the general public!  
 
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
 
points.js provides a simple mechanism to draw point graphs. It  uses
wz_jsgraphics.js  which is copyrighted by
Copyright (c) Balamurugan S, 2005. sbalamurugan @ hotmail.com
 
Usage:
var g = new point_graph();
g.add(x_name1, x_value1, y_name1, y_value1);
g.add(x_name2, x_value2, y_name2, y_value2);
 
g.render("canvas_name", "graph title");
 
//where canvas_name is a div defined INSIDE body tag  
<body>
<div id="canvas_name" style="overflow: auto; position:relative;height:300px;width:400px;"></div>
 
 
*/
 
function point_graph()
{
 this.y_values   = new Array();
 this.x_values   = new Array();
 this.x_max      = -64000; //MAX INT
 this.x_min      = 64000; //MAX INT
 this.y_max      = -64000; //MAX INT
 this.y_min      = 64000; //MAX INT
 this.x_maxname  = "MaxX";
 this.x_minname  = "MinX";
 this.y_maxname  = "MaxY";
 this.y_minname  = "MinY";
 
 this.add = function(x_name, x_value, y_name, y_value)
  {
   this.x_values.push(parseInt(x_value,10));
   this.y_values.push(parseInt(y_value,10));
 
   if(x_value > this.x_max)
   {  this.x_max = parseInt(x_value,10);
      this.x_maxname = x_name; }
 
   if(x_value < this.x_min)
   {  this.x_min = parseInt(x_value,10);
      this.x_minname = x_name; }
 
   if(y_value > this.y_max)
   {  this.y_max = parseInt(y_value,10);
      this.y_maxname = y_name; }
 
   if(y_value < this.y_min)
   {  this.y_min = parseInt(y_value,10);
      this.y_minname = y_name; }
  }
 
 this.render = function(canvas, title)
  {
   var jg  = new jsGraphics(canvas);
   var h   = 260;
   var w   = 360;
   var labelht = 15;
   var labelwd = 40;
   // Draw markers
   var i;
   jg.setColor("black");
   for(i = 0 ; i <= 5 ; i++)
     {
      jg.drawLine(0,Math.round((h/5*i)),labelwd+w,Math.round((h/5*i)));
     }
   jg.drawString(this.y_maxname+"",4,0));
   jg.drawString(this.y_minname+"",4,h));
 
   for(i = 0 ; i <= 5 ; i++)
     {
      jg.drawLine(labelwd+Math.round((w/5*i)),0,labelwd+Math.round((w/5*i)),h +labelht);
     }
   jg.drawString(this.x_maxname+"",0,h+labelht));
   jg.drawString(this.x_minname+"",w,h+labelht));
 
   jg.setStroke(1);
 
   jg.setColor("blue");
   for(i = 0; i < this.x_values.length; i++)
      {
       var ydif = this.y_max-this.y_min;
       if (ydif==0) ydif=1; // 0/0 replaced by 0/1
       var xdif = this.x_max-this.x_min;
       if (xdif==0) xdif=1; // 0/0 replaced by 0/1
       var x = Math.round(w*(this.x_values[i]-this.x_min)/x_dif);
       var y = Math.round(h*(this.y_max-this.y_values[i])/y_dif);
       jg.fillEllipse(x+labelwd, y, 3, 3);
      }
 
   jg.setFont("Verdana", fnt,  Font.BOLD);
   jg.drawStringRect(title, 0, h+labelht<<1 + 4, w+labelwd, "right");
   jg.paint();
  }
 
}

Could work.
With modified showData() ... I don't know how to work with dates (and if the 5 hours should be really subtracted)
Code:

function showData(){
  var i;
  var rh = glob.resp[0].rh;
  var dt = ""
//  alert(rh[0].r);
  var g = new point_graph();
 
  for(i=0;i<rh.length;i++){
    // dt=((rh[i].t/60*60)-5)*24)+{1.1.1970}; ...
    g.add(dt,rh[i].t,rh[i].r+"",rh[i].r);
  }
   
  g.render("pointCanvas", "Rating history");
}
« Last Edit: Jul 23rd, 2010, 6:23pm by Hippo » IP Logged

Janzert
Forum Guru
*****



Arimaa player #247

   


Gender: male
Posts: 1016
Re: Rate evolution curve and statistics ?
« Reply #12 on: Jul 23rd, 2010, 4:19pm »
Quote Quote Modify Modify

here is a really primitive grapher using the flot javascript graphing library.
 
http://arimaa.janzert.com/rating_plot/
 
Janzert
IP Logged
Hippo
Forum Guru
*****




Arimaa player #4450

   


Gender: male
Posts: 883
Re: Rate evolution curve and statistics ?
« Reply #13 on: Jul 23rd, 2010, 6:25pm »
Quote Quote Modify Modify

on Jul 23rd, 2010, 4:19pm, Janzert wrote:
here is a really primitive grapher using the flot javascript graphing library.
 
http://arimaa.janzert.com/rating_plot/
 
Janzert

 
Oh nicely done Smiley I could stop trying Smiley
IP Logged

Fritzlein
Forum Guru
*****



Arimaa player #706

   
Email

Gender: male
Posts: 5928
Re: Rate evolution curve and statistics ?
« Reply #14 on: Jul 23rd, 2010, 9:28pm »
Quote Quote Modify Modify

on Jul 23rd, 2010, 4:19pm, Janzert wrote:
here is a really primitive grapher using the flot javascript graphing library.
 
http://arimaa.janzert.com/rating_plot/
 
Janzert

Wow, nicely done.  Your own ratings plot is one of the more intriguing ones.  Also rabbits' is quite unusual.
 
It takes a while to load the graph for bot_arimaazilla, but the result is interesting because is roughly tracks the history of game room rating inflation/deflation.  (Basically we have been stable.)  Bot_bomb2005P1's graph is somewhat less informative, because 3245 of its 8760 games were against just one opponent.
 
My own graph shows two times when I intentionally inflated my rating (to 2400 and then later to 2500) followed by rapidly letting it deflate to a more reasonable level after I reached my goal.  It's a bit embarrassing to be reminded how much I once cared about my rating, and what I did to pump it up.  Now I think my game room rating of 2500 is roughly accurate, or maybe a touch low.
IP Logged

Pages: 1 2  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Arimaa Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.