Author: Albert Silver
Date: 04:54:56 01/20/02
Go up one level in this thread
On January 20, 2002 at 02:40:21, Tom Kerrigan wrote:
>I believe I finally have my program working correctly (had to change one stupid
>character). I verified several of these BH numbers by hand. Here are the
>standings and the source, again.
>-Tom
I hope you won't mind my making a suggestion (great effort BTW). It's customary
to group up programs with the same number of points, and to then order them
according to their tie-breaks. Giving something along the following lines:
Place Program Points Buch.
1-2 ban 3.0 5.5
diep 3.0 5.0
3-6 DeepFritz 2.5 5.0
pharaon 2.5 4.5
X-Engine 2.5 4.5
TombRaider 2.5 3.5
Albert
>
>
>
>
>
>Place Program Points Buch.
> 1. ban 3.0 5.5
> 2. diep 3.0 5.0
> 3. DeepFritz 2.5 5.0
> 4. pharaon 2.5 4.5
> X-Engine 2.5 4.5
> 6. TombRaider 2.5 3.5
> 7. SearcherX 2.0 6.0
> 8. Yace 2.0 5.5
> KingKings 2.0 5.5
> 10. IsiChess 2.0 5.0
> Sjeng 2.0 5.0
> SandmanJr 2.0 5.0
> 13. sherifk 2.0 4.5
> JZInsomniac 2.0 4.5
> ChesterX 2.0 4.5
> Hiarcs8x 2.0 4.5
> TaoYin 2.0 4.5
> 18. crafty 2.0 4.0
> 19. ZarkovX 2.0 3.5
> gambitmaster 2.0 3.5
> 21. monsoon 2.0 3.0
> 22. BK-Chess 1.5 5.5
> Somnus 1.5 5.5
> Amateur 1.5 5.5
> 25. PostModernist 1.5 5.0
> 26. Ferret-CCT 1.5 4.5
> WarpX 1.5 4.5
> 28. Esc 1.0 6.0
> CyberPagno 1.0 6.0
> 30. Leila 1.0 5.0
> Aristarch 1.0 5.0
> 32. AvernoX 1.0 4.5
> 33. QuarkX 1.0 4.0
> Hossa 1.0 4.0
> Butcher 1.0 4.0
> Tinker 1.0 4.0
> QALAT 1.0 4.0
> 38. Armageddon 1.0 3.5
> ArasanX 1.0 3.5
> Chezzz 1.0 3.5
> 41. Lordx 1.0 2.5
> 42. nullmover 0.0 4.5
> djenghis 0.0 4.5
> 44. Celes 0.0 4.0
> PolarChess 0.0 4.0
> 46. pyotr 0.0 3.5
>
>
>
>
>
>#include <stdio.h>
>#include <memory.h>
>#include <string.h>
>
>typedef struct {
> char name[100];
> float score;
> int opp[100];
> int opps;
> 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, j;
>
> 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].opp[player[white].opps++] = black;
> player[black].opp[player[black].opps++] = white;
> 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)
> for (j = 0; j < player[i].opps; ++j)
> player[i].buch += player[player[i].opp[j]].score;
> 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.