Author: Tom Kerrigan
Date: 20:46:50 07/24/03
Go up one level in this thread
Given a round robin tournament with 13 participants of equal strength, 5 of
which are The King:
There's a 14% chance The King would take the top 3 spots.
There's an 11.4% chance of a specific program winning the tournament. (This
problem is apparently more complex than it seems--I would have guessed a
1/13=7.6% chance of any given program winning the tournament.)
In other words, you should only be slightly less surprised that The King took
the top 3 spots than if a certain program won a tournament against 12 other
programs of the same strength. In other words again, it's unlikely that The King
is the same strength as the other programs.
Just an experiment: if you lower Ktulu's rating by 200 points and Crafty's
rating by 100 points and increase Shredder's rating by 50 points and The King's
rating by 25 points, The King has a 23.3% chance of taking the top 3 spots...
not THAT unlikely...
-Tom
#include <stdio.h>
#include <memory.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
//#define DEBUG
#define PROGS 13
char *program[PROGS] = {
"The King 3.23D",
"CM9000 Grailmaster7",
"The King 3.23M2v.5",
"The King 3.23 WHx",
"The King 3.23SKR",
"Junior 8",
"Fritz 8",
"Ruffian 1.0.5",
"Crafty 19.03 B",
"DeepSjeng 1.5",
"Chess Tiger 14.0",
"Shredder 7",
"Ktulu 3.7"
};
int rating[PROGS] = {
2400,
2400,
2400,
2400,
2400,
2400,
2400,
2400,
2400,
2400,
2400,
2400,
2400
};
int points[PROGS];
int place[PROGS];
int next_place;
int ignore[PROGS];
int result(int r1, int r2)
{
double p;
int r;
p = (double)(r2 - r1);
p /= 400.0;
p = pow(10.0, p);
p += 1.0;
p = 1.0 / p;
p *= 100.0;
r = rand() % 101;
if (r < (int)p)
r = 2;
else if (r == (int)p)
r = 1;
else
r = 0;
#ifdef DEBUG
printf("%d vs. %d, winning percentage %f, r: %d\n", r1, r2, p, r);
#endif
return r;
}
void sort()
{
int i, old_place, best_score = -1;
for (i = 0; i < PROGS; ++i) {
if (ignore[i]) continue;
if (points[i] > best_score)
best_score = points[i];
}
old_place = next_place;
for (i = 0; i < PROGS; ++i)
if (points[i] == best_score) {
place[i] = old_place;
ignore[i] = 1;
++next_place;
}
}
int tourney()
{
int i, j;
memset(points, 0, sizeof(points));
for (i = 0; i < PROGS; ++i)
for (j = i + 1; j < PROGS; ++j)
switch (result(rating[i], rating[j])) {
case 0: points[j] += 2; break;
case 1: points[i] += 1; points[j] += 1; break;
case 2: points[i] += 2; break;
}
next_place = 0;
memset(ignore, 0, sizeof(ignore));
for (i = 0; i < PROGS; ++i)
sort();
#ifdef DEBUG
for (i = 0; i < PROGS; ++i) {
printf("place: %2d, points: %.1f, program: %s, rating: %d\n",
place[i],
(float)points[i] / 2.0,
program[i],
rating[i]);
}
getc(stdin);
#endif
int top_three = 0;
for (i = 0; i < 5; ++i)
if (place[i] <= 2)
++top_three;
if (top_three >= 3)
return 1;
return 0;
}
void main()
{
int i, tourneys, t;
srand(time(NULL));
for (tourneys = 1000; ; tourneys *= 2) {
t = 0;
for (i = 0; i < tourneys; ++i)
t += tourney();
printf("tourney() returned 1: %d out of %d times, %f percent\n", t, i,
((float)t / (float)i) * 100.0);
}
}
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.