Skip to content

A command line application that analyzes chess games in PGN file format

License

Notifications You must be signed in to change notification settings

mrdcvlsc/analyse-pgn

Repository files navigation

analyse-pgn

build

a simple chess game PGN file analyser on command line terminal

this program will generate an .analyzed.pgn file, and a .stats.txt from a pgn file.

The .analyzed.pgn will contain the following:

  • per-move comments showing the best move
  • per-move comments on how good or bad the move was compared to the best move.
    1. brilliant!!! - indicates that the move is the best move
    2. excellent!! - indicates that the move is a top move
    3. good! - indicates that the move is still accurate or average
    4. inaccurate? - indicates that the move provide a slight disadvantage
    5. mistake?? - the move is slightly losing
    6. blunder/missed - blunder is a completely losing move, missed is when you give up a large advantage
    • W - means that the advantage is so great, the changes of winning is astronomical, as long as you don't blunder big, or played many inaccurate moves
    • L - means that the disadvantage is so great, the chances of lossing is astronomical, as long as the other side does not blunder big, or played many inaccurate moves

The .stats.txt file will contain

  • the total counts of brilliant, excellent, good, average, mistake, blunder, and missed moves in the pgn game.
  • it will also provide a percentage representing the accuracy of moves a color played through out the whole game.

the resulting Analyzed pgn is recomended to be loaded on chess gui's like Chess Arena for better visualization.


Build Support

  • standard >= C++17
  • Windows MinGW Makefile
  • Linux GCC Makefile

Build apgn

git clone https://github.com/mrdcvlsc/analyse-pgn.git
cd analyse-pgn
make
make clean

Install & Uninstall for Linux

sudo make install
sudo make uninstall

analyse a pgn game

The --help menu

Modifier Flags:

-engine [PATH]  - the directory location with the
                  filename of your pgn file

-color [A,W,B]  - select one letter from A, W or B, where
                  W = white, B = black, and A = both

-oskip [+I>=0]  - this is the number of moves in the opening
                  that the engine will not analyse
                  this value should be >= 0 and < the total moves

-depth [+I>0]   - this is how deep the chess engine will analyse
                  the given pgn file, the larger the number the
                  the better the analysis, but will also take
                  more time to finish, this value should be >= 1

-threads [+I>0] - this is the number of the worker threads you want
                  your engine to use, the more threads the faster
                  the analysis, given that you did not exceed your CPUs
                  maximum thread, but if you did a bigger thread will
                  also slow down the analysis

Defaults Flag values - if a flag is not specified, the default value will be used, below are the default values of each flags :

    engine  - ../analyse-pgn/bin/engines/stockfish11_x64
    color   - A
    oskip   - 4
    depth   - 11
    threads - 1

Example 1 - Using Default Values:

apgn myGame1.pgn myGame2.pgn

Example 2 - Using Costum Values:

apgn -color B -threads 4 myGame1.pgn myGame2.pgn

NOTE: this examples will use the costum values for the specified flags
      and use the default values for the unspecified flags.

how to use analyse-pgn in windows (Non-Developers)

Installation Part

  1. Download the pre-compiled program analyse-pgn | zip | 7z | tar.gz

  2. Move and Extract the file where you want to put it permanently

  3. Add path of analyse-pgn to your Environment Variables. below are some tutorial on how to do this:

Running The Program (you can skip the steps 1,2,&,3 (Installation Part) after you have done it once)

  1. Copy the filepath of the .pgn file you want to analyse

  2. Open the command line terminal CMD

  3. Follow the format and Paste the pgn's path that you copied to analyse the game

    Command Format :

    • apgn -color COLOR /PATH/GAME.pgn

    or

    • apgn -color COLOR -oskip OPENING_SKIP -depth DEPTH -threads THREADS /PATH/GAME1.pgn /PATH/GAME2.pgn

    you can pass as many pgn file you want to the program

example:

let us say for you have downloaded a pgn from one of your online games where you have played as the white piece ... let's call that pgn file yourChessGame.pgn and you want to analyse it.

to do that you need to input the command below in your CMD

apgn C:/Users/%USERNAME%/Downloads/yourChessGame.pgn -color W

the command above will analyse yourChessGame.pgn file in the downloads folder for the player color white, this will produce another pgn file called yourChessGame.analyzed.pgn, this is the pgn file that contains comments for each move on how well you did, and what is the best move for that turn, It will also produce another file called yourChessGame.stats.txt, this will contain statistical information of your moves.

load yourChessGame.analyzed.pgn on chess GUI's like Chess Arena and PGN Viewer to better visualize your moves.