Subject Filter

A scientist's take on the Game of Kings
| Chess Puzzles | Book Reviews | | Annotated Games | Opening Analysis | Science | First Time Here?

Saturday, March 28, 2015

Making Random Moves

Most human players and chess computer engines alike select their moves through a combination of two processes: searching through the consequences of possible moves, and evaluating current and future positions. Each of us have our own talents and capabilities in performing these two tasks. But what if chess was played randomly, with no bias, ideas, experience or thought put into any moves?

Well, somebody took the time to answer this question, and did so in an impressive fashion. This report by @billautomata, generated approximately 100,000 random games, finding that a vast majority ended in a draw (85%) and lasted an average of 342 moves. This data is presented with some very neat visualizations.

While the high draw is not necessarily surprising (after all, these computer players are identically matched in skill), it would be interesting to know if White or Black had a greater share of the few wins that did occur. Unfortunately, the data from the above analysis is not freely available (as far as I know).

In light of this, I have utilized the chess.js JavaScript library to create an accessible way to generate and store random computer games. You can access this simple tool from my other site. While this may not serve any useful purpose, it could nonetheless be interesting to see which side (White or Black) ends up with a better score after random moves. I should note that others have created random moving chess programs with better visuals, such as developed by the chessboard.js team.

That's all for this week! Stay tuned for more computer analysis and links. Please share your thoughts, questions, comments and consternations below. 

Saturday, March 21, 2015

Complete Datasets for Fischer and Carlsen as White

If you read this blog regularly or saw my work featured at ChessBase, you will be familiar with the tools I have developed to analyze square utilization and occupancy, and represent these as heatmaps. In response to a reader comment, I am providing available for download the complete datasets for both Fischer and Carlsen as White. I may eventually post the corresponding datasets of these two world champions playing Black.

This data is being provided for now with very limited annotation (Select 'Read More' to view); it is up to you, dear reader, to decide how to use it, what points to examine further, and what conclusions you can draw from it. If you download these ZIP packages, you will find the calculated analysis of square utilization and occupancy, as well as the differential data and a subfolder containing heatmap representations for each of the White and Black pieces (all 12 piece types).

Remember, a scientific approach to chess only means that you are willing to test your own ideas about the game in a systematic way, hoping to improve your understanding and thus your performance. Hopefully, the tools and datasets I have made available will assist you in asking scientific questions about chess. In the future, I may post the insights I have gleaned from analyzing this and similar datasets. This future may have to wait some time however, as I have been rather busy lately with my professional commitments!

Select 'Read More' to see details regarding methodology as well as a few initial insights. Please feel free to share your own insights from this dataset, or your critical comments regarding this method! Stay tuned for more science on the squares!

Wednesday, March 18, 2015

Finding Difference Makers

Using JavaScript tools I recently created, you can determine the square utilization or occupancy for any particular piece, for any given square, across all moves and all games in a PGN database. One potentially useful application is to apply these tools separately to the wins and losses (1-0 versus 0-1) in the database of your choice. As featured in a recent ChessBase article, I have done this to find which piece movements or placements are featured more often in wins versus losses. These are potential difference makers in a chess game.

In this post, I will describe in more detail how I performed these calculations. Although this can be done by hand, I created an Excel spreadsheet to facilitate processing of the data you can get from using the aforementioned tools. This spreadsheet is available for download; select 'Read More' to see the rest of this article to find instructions on how use the excel file, as well tips on how to represent the results using the heatmap tool. Stay tuned for more differential data and analysis in the coming weeks.

Friday, March 13, 2015

As featured on ChessBase

It was very exciting to see this morning that the editors at ChessBase have published the article I wrote that describes the chess tools I have recently posted about. For those who haven't seen it, I encourage you to give it a look.

Some of you may be viewing this blog for the first time due to the ChessBase article. To all of you, I say welcome! Although my updates to this blog are not that frequent (once a week at best), if you found the article interesting you should subscribe or keep your eye on this space. Here is some of what you can come to expect in the near future from Science on the Squares:
  • The excel file 'tool' I use for normalizing the data I collect and finding the differential between two data sets, available for download along with instructions
  • More information on how I created the heatmaps, and why I used particular settings
  • A post concerning what I think the proper use of these tools are. This will expand upon my thoughts from a previous post, in which I argued for a scientific approach to chess.
  • Responses to the comments by readers of the ChessBase article.
  • More data and analysis of players and openings! In addition to the Sveshnikov Sicilian, I have already looked at the Winawer French, the Ruy Lopez Exchange Variation and Breyer Variation, and the Smith Morra Gambit.
Thanks again to all my readers, and a special thanks to the editors at ChessBase!

Sunday, March 8, 2015

Chessboard Heatmap and Updates

In a previous post, I introduced a suite of Javascript tools that can be used to reformat PGN files and determine square utilization (traffic) and square occupancy (parking) for different pieces. Since that post, I have rewritten the code and improved the functionality of each of these tools. I have used these tools to collect data on square utilization or occupancy, which I then process further in an excel file (which I will make available shortly) and generate heatmaps using Plotly. However, Plotly was cumbersome to use, having to reformat the heatmap for each data set.

Here, I am introducing another Javascript tool that can be used to take square utilization or occupancy data and generate customizable heatmaps specifically for chess. This can be found at the following address:

In the rest of this post, I describe how to use the features on the heatmap program, as well as detailing other updates to the site. Select 'Read More' to view the rest of the article. Please feel free to share your comments regarding this tool, especially if you used it to generate interesting insights!

Sunday, March 1, 2015

Tools for Statistics of the Squares

Ever wonder which squares see the most traffic? Or which squares have pieces 'parked' on them for the longest periods of a game? Now, you can answer these questions easily using a series of JavaScript powered tools I have developed. These are based upon the LT-PGN JavaScript viewer, and calls upon that code (which I did not write) for certain functions. In fact, it directly calls upon the LT-PGN PGN2FEN tool, although my adaptation can handle PGN files with multiple games. 

I was inspired to develop these tools after reading some of the chess-visualization articles posted on the ChessBase website, namely, the analysis of square utilization by Seth Kadish earlier last year (analysis which you can also find at Seth's blog). I really liked the approach, and although the source of the game PGNs were made clear, I wasn't sure how he extracted the data. Also, I thought there was potential to observe more than just square utilization, or 'traffic'.

In order to carry out this analysis, I created three separate JavaScript tools. They aren't shining examples of efficient coding, but they get the job done. They are as follows:

Reformatting PGN Text
Although PGN files from can be used directly in the downstream applications, the chess software I use (HIARCS) places line breaks within the game score. This tool will remove them, leaving all other features of the PGN intact.

Move Counting (Determining Square 'Traffic')
This tool takes a PGN file, with single or multiple games, and can determine the square utilization or traffic of the White player, Black player, or both players. It also reformats the PGN so as to remove the header tags.

Batch Conversion of PGN to FEN, Counting Square Occupancy ('Parking')
This tool takes a PGN file, with single or multiple games, and does several things. First, it removes header tags from the PGN. Then, it converts the PGN first to FEN, then to an expanded version of FEN in which each square, filled or empty, is declared. Finally, the occupancy, or parking, of different pieces (selected by user) on each square is reported.

To see some example results of these tools, which expands upon the aforementioned work by Kadish, please select 'Read More' below.