Skip to content

rm36/VisualizationProject

Repository files navigation

VisualizationProject - Chess

This project shows how different visualization techniques can help understand games. The analysis is over 7000 games by Magnus Carlsen (current world champion), which were obtained from here.

Task 1. Visualize the average color of the piece at every square

In this task, if a given square (e.g. the first square is a1) had white piece for 20/40 turns, a black piece for 10/40 turns, and no piece for 10/40 turns, it would get a score of +10, whereas if it had a black piece for 20/40 turns, a white piece for 10/40 turns and no piece for 10/40 turns, it would get a score of -10. The first game would then result in the following plots. Notice how choosing a diverging colormap (red representing the player using white pieces and blue representing the player using black pieces) it tells us information about which player had control of any given square.

First game square color First game square color diverging

In the second plot we can see that the square c1 was controlled by a black piece for longer than a white piece.

When doing the analysis over the 700 games by Magnus in the database, we get interesting overall statistics. For example, that the squares b4 and g5 have relatively the same time controlled by either color. Also, plotting it in 3D can show better small differences on each square such as f7 and g7, which are very difficult to notice the color differences in the 2D plot.

All games square color All games square color 3D

Task 2. Visualize the average color that attacks each square

Another way to define "controlling" a square is by being able to capture that square. So a square would have a score of +1 on a turn when a white piece could capture a black piece on that square, -1 on a turn when a black piece could capture a white piece on that square, and 0 if none or both colors could capture that square. Here is the result of the analysis for all games.

All games square attack All games square attack 3D

Notice how the b4, c5, f5 and g4 are "controlled" by black, since it aligns diagonally where the bishops are (c8 and f8) and similarly for white. Also, the 3 ranks on each side are controlled by the color very clearly, whereas the middle ranks are contested.

Task 3. Piece movement

The following plot shows the total movement (in king steps) that a piece does over a game. For the first game we have the following plots, both in linear and logarithmic scale. Notice how log is much better because one piece moved much more than all the other ones in the game.

First game piece movement linear First game piece movement log

And now the plots for the average per-game piece movement for all games.

All games piece movement All games piece movement 3D

Notice how while the 3D plot occludes visibility, the actual values are easier to read from that plot, and it's also easier to measure the relative difference in movement. One learning from the 2D plot is that the 3 pawns in files c, d and e move more than all the others, which makes sense because they're in the center and they don't weaken the king (like f pawns do when they move early).

Task 4. Piece tension

We define tension when a piece can be captured in a given turn but isn't. These plots add up the number of turns they were in "tension".

All games piece movement All games piece movement 3D

Notice how:

  • The pawns had the most turns in tension
  • The e pawns, which are in front of the kings, had the most tension
  • The king wasn't ever in tension (that would be checkmate, by definition)
  • The queen was very rarely in tension, probably because is the most valuable piece
  • The rooks and knights (e.g. a1 and c1) are in tension less time in average than the bishops.

About

Visualization of Chess games by the world champion

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages