destaq / chess-graph Goto Github PK
View Code? Open in Web Editor NEWA program that will produce a graphical sunburst chart of chess openings from the PGN that is provided to it
A program that will produce a graphical sunburst chart of chess openings from the PGN that is provided to it
First of all GREAT WORK ! Amazing tool ;)
I kindly ask you the possibility to print (at least on terminal or on a .txt file) the best (W/B ratio) and worst line for each level.
Something like:
Move | Best (W/B, ngames) | Worst (W/B, ngames) |
---|---|---|
1 | 1.e4 (0.6, 10) | 1.d4 (0.4, 12) |
2 | 1.e4 e5 (0.5, 8) | 1.d4 Nf6 (0.3, 9) |
and so on.... |
I'm available to help you doing this (just send me an email)
tested on google colab
pip install -U chess-graph
import chess_graph
result
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
[<ipython-input-4-af3db3b3152d>](https://localhost:8080/#) in <cell line: 1>()
----> 1 import chess_graph
2 frames
[/usr/local/lib/python3.10/dist-packages/chess_graph/new_parser.py](https://localhost:8080/#) in <module>
----> 1 import pgn
2
3
4 def parse_games(database, depth, custom_branching, color, name):
5 database = open(database)
ModuleNotFoundError: No module named 'pgn'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
The outermost ring is lighter then the rest. Need to make it the same color to prevent confusion and aesthetic interference.
Currently, this tool can analyze games up to any depth. However, the time it takes to do so is exponentially correlated to depth. This is because it is traversing the PGN using brute force.
To put it into perspective, a depth of 5 takes 30 seconds, a depth of 8 about two minutes.
This is low-priority, as it is unlikely people will want to make graphs to such depths, but if there is any way to improve the execution of the code, that would be great.
With the new updates to the code, you can now edit the file and remove any slices that are too small, to prevent the fragmentation look.
This works perfectly well - except for the first level!. On the innermost circle, even if you have a move that is played only once - e.g. a4, with a percentage of 0.1% let's say - it still shows up!
Here is the code for those interested:
`del_list = []
for i in range(len(percentage_holder)):
if percentage_holder[i] <= 5 and parents[i] != '':
del_list.append(i)
for i in range(len(parents)): # loop through all parents
if i in del_list: # if that parent is in the bin
death = ids[i] # find that parent's ID so we can locate children
for x in range(len(parents)): # loop through parents again to find children
if parents[x] == death: # if child's parent is equal to death
del_list.append(x) # mark child for death as well
percentage_holder = [percentage_holder[i] for i in range(len(percentage_holder)) if i not in del_list]
ids = [ids[i] for i in range(len(ids)) if i not in del_list]
labels = [labels[i] for i in range(len(labels)) if i not in del_list]
parents = [parents[i] for i in range(len(parents)) if i not in del_list]
values = [values[i] for i in range(len(values)) if i not in del_list]`
Like in the example that you reported from this site: https://blog.ebemunk.com/a-visual-look-at-2-million-chess-games/
you can see that odd/even moves have a darker/lighter background
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.