Skip to main content

A package that can create a multi-level, shaded, piechart visualization of chess games.

Project description

Python application

The Chess Opening Analyzer

About

A program that will produce a graphical sunburst chart of chess openings from the PGN that is provided to it.

You can easily run this with the pip module in one function by simply specifying the path to the PGN database that you would like to have analyzed.

This package can customize the multi=level pie chart in many ways. It can shade segments based on win percentage, you can click to zoom in, openings are highlighted, and so much more. It's the perfect learning tool for anyone interested in chess or wishing to improve their opening skills!

Features

  • Make graph of games to any depth
  • Upload a custom database and see how your chart looks like
  • Hover to see metadata such as game count and percentage of parent
  • Easily find openings with simple hover tooltip identification
  • Click to zoom in on a slice and expand it, making it easy to magnify any slice of the pie chart
  • Downloadable files: you can download the chart as an interactive HTML, or as a static PNG/JPEG/SVG/WEBP image with just a few clicks
  • Win Ratio Shading means that you will never be in doubt as to what next move is statistically best
  • Hide small slices and prevent them from showing up in the graph!

Using via pip install

  1. pip install chess-graph
  2. Open terminal/interpreter.
  3. from chess_graph import chart
  4. chart.graph(*path to file*, depth = 5, fragmentation_percentage = 0.0032, should_defragment = False, custom_branching = False)
  • Note that the path to the pgn file must be relative to the current directory python is running in. For example, if you have the pgn downloaded on your Desktop, you could easily solve this issue by navigating to Desktop within terminal (cd Desktop). From there, you can run path to file simply by typing in the filename (assuming it is in Desktop). If this is confusing, just type in the full path.

Prerequisites

  • Runs in Python 3, must have Python 3 installed
  • Requires Plotly and Python-Chess

You can install Plotly and Python-Chess using PyPi, as long as you are an admin user on your device. To do so, simply type pip install plotly and pip install python-chess into your terminal.

Downloading

Downloading is an option, although you need to make sure you have the proper libraries installed.

Currently, you can uncomment the download interactive HTML file without anything else to download. If you do so, an HTML file of the graph will be saved to your device, which you can open with your browser.

You can also download the file as: SVG, PDF, JPEG, PNG, and WebP.

However, if you want to download in these formats you need the following installed.

npm install -g electron@1.8.4 orca

pip install psutil requests

pip install psutil

Examples

All examples are those of Magnus Carlsen's OTB tournament games

Simple Pie Chart

Hover Functionality | Show Percentage of Parent + Game Count

Click to Zoom

Extra Info

I based this chart loosely off of a post that I read on ebemunk's blog - you can find the link here: https://blog.ebemunk.com/a-visual-look-at-2-million-chess-games/. However, that project was written in Java and it didn't have everything that I wanted, such as showing all the games, zooming in, etc.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chess-graph-1.4.4.tar.gz (47.4 kB view hashes)

Uploaded Source

Built Distribution

chess_graph-1.4.4-py3-none-any.whl (52.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page