PCGG
Piece Counts Game Generator
version 1.11
03Sept2014

A. Intro
This is a script to generate a database of games in pgn format based
on the material of ending positions of the user supplied pgn games.
The idea is from Frank to possibly get some data out of game results
from engine tournaments and matches. This script is tested on windows 7.

B. Required Files
1. PCGG_v1-11.py
2. pgn-extract-17-14.exe
3. pgn files supplied by user (example fct1-20800.pgn)

C. Procedure to run
1. Install python 3.4.1
2. Put the required files in same directory, example
c:\chess\pgn_stat
copy the files in item B above to this directory
3. Run or double-click on the PCGG_1-11.py file
4. Then follow the simple instruction written in the console window.

D. How the script works
* First the script will make a copy of original pgn file by the user.
* The original file will not be changed.
* The copy will be cleaned of comments and other annotations. A file
called pgnextracterr.log will be outputted to see warnings during
pgn-extract processing. This file will not increase in size as it will
overwrite the file everytime pgn-extract runs.
* The copy will be reformatted by pgn-extract to produce a FEN in
every ending of every game.
* The script will read the FEN's in these file then count P,p,N,n and
so on, for all pieces.
* The pgn-extract is used to prepare the pgn files depending on the user
input like, number of moves, and result 1-0, 0-1 and others.
* The script will also create a temporary file during its processing.
This file will be deleted after processing.
* The script will save the games once the criteria specified by the user
is meet.
* The copy of orig pgn file will be deleted after running the script.
