Author: Tom Kerrigan
Date: 14:17:23 01/19/02
So I couldn't find the standings on the CCT page so I wrote a program to compute
them from the PGN file. (Yeah, I'm a dork.) Here goes...
Place Program Points Buch.
1. ban 2.0 1.0
SearcherX 2.0 1.0
pharaon 2.0 1.0
diep 2.0 1.0
TaoYin 2.0 1.0
X-Engine 2.0 1.0
7. Yace 1.5 1.0
BK-Chess 1.5 1.0
sherifk 1.5 1.0
ChesterX 1.5 1.0
TombRaider 1.5 1.0
gambitmaster 1.5 1.0
PostModernist 1.5 1.0
WarpX 1.5 1.0
15. DeepFritz 1.5 0.5
16. JZInsomniac 1.0 1.0
IsiChess 1.0 1.0
CyberPagno 1.0 1.0
Sjeng 1.0 1.0
SandmanJr 1.0 1.0
Ferret-CCT 1.0 1.0
22. KingKings 1.0 0.5
crafty 1.0 0.5
Esc 1.0 0.5
ZarkovX 1.0 0.5
26. Aristarch 1.0 0.0
QuarkX 1.0 0.0
Hossa 1.0 0.0
monsoon 1.0 0.0
ArasanX 1.0 0.0
Butcher 1.0 0.0
Somnus 1.0 0.0
Hiarcs8x 1.0 0.0
Leila 1.0 0.0
Chezzz 1.0 0.0
36. Amateur 0.5 0.5
37. AvernoX 0.0 0.0
PolarChess 0.0 0.0
Celes 0.0 0.0
Tinker 0.0 0.0
QALAT 0.0 0.0
Lordx 0.0 0.0
djenghis 0.0 0.0
Armageddon 0.0 0.0
nullmover 0.0 0.0
pyotr 0.0 0.0
Actually, I'm not sure how frequently I'll check this stuff, so if other people
want to use the program, here it is. (Assumes the games are in a file called
games.pgn in the same directory.)
#include <stdio.h>
#include <memory.h>
#include <string.h>
typedef struct {
char name[100];
float score;
float buch;
} player_t;
player_t player[100];
int players = 0;
FILE *pgn;
int grab_player(char *line)
{
char name[256];
int i, j = 0;
for (i = 0; line[i] != '\"'; ++i);
for (++i; line[i] != '\"'; ++i)
name[j++] = line[i];
name[j] = 0;
for (i = 0; i < players; ++i)
if (!strcmp(name, player[i].name))
return i;
strcpy(player[players].name, name);
player[players].score = 0.0;
player[players++].buch = 0.0;
return players - 1;
}
void select_sort(int s)
{
int i;
float fake_score;
float best_score = -1.0;
int best_i;
player_t t;
for (i = s; i < players; ++i) {
fake_score = player[i].score + (player[i].buch / 1000);
if (fake_score > best_score) {
best_score = fake_score;
best_i = i;
}
}
t = player[s];
player[s] = player[best_i];
player[best_i] = t;
}
void print_results()
{
int i;
printf("Place Program Points Buch.\n");
for (i = 0; i < players; ++i) {
if (i != 0 &&
player[i].score == player[i - 1].score &&
player[i].buch == player[i - 1].buch)
printf(" ");
else
printf("%4d. ", i + 1);
printf("%-13s %-6.1f %-5.1f\n",
player[i].name, player[i].score, player[i].buch);
}
}
int main()
{
char line[256];
int white, black, i;
pgn = fopen("games.pgn", "r");
for (;;) {
if (!fgets(line, 256, pgn))
break;
if (strstr(line, "[White \""))
white = grab_player(line);
if (strstr(line, "[Black \""))
black = grab_player(line);
if (strstr(line, "[Result \"")) {
player[white].buch += player[black].score;
player[black].buch += player[white].score;
if (strstr(line, "1-0"))
player[white].score += 1.0;
else if (strstr(line, "1/2-1/2")) {
player[white].score += 0.5;
player[black].score += 0.5;
}
else
player[black].score += 1.0;
}
}
fclose(pgn);
for (i = 0; i < players; ++i)
select_sort(i);
print_results();
return 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.