This repo holds all files related to chessviz
, and interactive visualization of chess game data created as a final project for W209: Data Visualization, a course in UC-Berkeley's Masters of Information in Data Science (MIDS) program.
Check out our mid-term presentation
This repo is structured as follows:
app/
= all files necessary to run the app (JS, CSS, HTML, and data)app/<language>
= JS, CSS, and HTML code written by the project authorsapp/<language>/lib/
= JS, CSS, and HTML code from external sourcessetup/
= all files needed to seed a new directory for running the app. The scripts in this directory handle installing dependencies and pulling data. The directory assumes a Unix-alike operating system, so Windows users should use it with Ubuntu on Windows 10 or in a VMsandbox/
= workspace for experimentation. Not needed to run the applicaiton.
Raw data used in this project come from the FICS Games Database. That database holds chess match records for all games since 2016 involving at least one Grand Master.
The data is stored in the Portable Game Notation (PGN), with an example of a single game as follows:
[Event "FICS rated standard game"]
[Site "FICS freechess.org"]
[FICSGamesDBGameNo "410004192"]
[White "BradVanHoozer"]
[Black "figasecond"]
[WhiteElo "2022"]
[BlackElo "2050"]
[WhiteRD "0.0"]
[BlackRD "0.0"]
[TimeControl "600+10"]
[Date "2016.12.31"]
[Time "23:31:00"]
[WhiteClock "0:10:00.000"]
[BlackClock "0:10:00.000"]
[ECO "D37"]
[PlyCount "27"]
[Result "1/2-1/2"]
1. d4 d5 2. Nf3 Nf6 3. e3 e6 4. c4 Be7 5. Nc3 O-O 6. Bd3 c5 7. O-O Nc6 8. dxc5 Bxc5 9. a3 a6 10. b4 Be7 11. Bb2 dxc4 12. Bxc4 b5 13. Be2 Bb7 14. Qb3 {Game drawn by mutual agreement} 1/2-1/2
In order to calculate some of the data for specific tasks, the data needs to processed into individual lines for aggregation. The convert_raw_data.py
script takes the PGN file and goes over them, extracting for each move, the following data:
- Game number
- White username
- White ELO
- Black ELO
- Black username
- Turn number
- Result (white win, black win or draw)
- Piece
- Player (white or black)
- Piece type
- Starting piece position
- Move to location
- Taken piece
- Player (white or black)
- Piece type
- Starting piece position
We used the python-chess
package to read in the PGN file for initial processing.