Author: Andreas Stabel
Date: 00:45:16 04/12/05
Go up one level in this thread
On April 08, 2005 at 00:23:15, Tor Alexander Lattimore wrote:
>Hi
>First, is it alright to use enormous.pgn for a book? Secondly, i've been trying
>to parse it recently and my program seems to be doing fine until about 300,000
>games where it just returns EOF. I've tried opening and reading from other large
>files and get the same problem. Initially I tried using C++'s <iostream>
>library, but when that didn't work I tried standard C fopen() and fgetc() with
>no more success. The file is 900 MB, so shouldn't be a problem where windows
>does strange stuff with 2GB or > files.
>
>Below is some very cut down code that returns EOF long before the file is
>through.
>/*
>pgn_in is a string to the pgn file.
>this program will return EOF after about 360,000 games
>*/
> int games=0;
> string input;
> ifstream pgn_in(pgn_file.c_str());
> while (!pgn_in.eof())
> {
> pgn_in >> input;
> if (input=="[Event") games++;
> }
> book_out.close();
> pgn_in.close();
> cout << games << "\n";
> return true;
>
>Anyone have any ideas? The same code as above works just fine in my Gentoo Linux
>system, but not Windows XP home.
>cheers
>Tor
Hi,
I have made a program that manage to parse the whole file.
I get the following statistics:
Read 1496327 games with 111941117 moves, 25458158 lines, 945950820 bytes !
Got max. 549 moves in game 237225 before line 4052033 !
Got 3545011178 legal moves in 113437444 positons !
Got max. 92 legal moves after move 105 in game 376190 line 6425909 !
Total move statistics:
Pawn moves = 30386622, Knight moves = 20403265, Bishop moves = 17748466
Rook moves = 20418343, Queen moves = 13403989, King moves = 12190285
Check moves = 5571618, Mate moves = 48748, Stalemate moves = 986
Hit moves = 23116992, En passant moves = 86830, Pawn two moves = 8494513
Short castlings = 2337283, Long castlings = 272570
Promotion to queen = 82298, Promotion to rook = 839
Promotion to bishop = 281, Promotion to knight = 1519
Total game statistics:
White won = 579064, Drawn = 447291, Black won = 435569
Unknown result = 34403, Illegal result = 0, Conflicting results = 0
White mated = 21259, White stalemated = 479
Black mated = 27489, Black stalemated = 507
Best regards
Andreas
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.