Boardgaming and Coding

This post has taken me a day or three to write. Hence why you haven’t been bored by me.

Plus my only other gaming has been the enrichment session for my students since the last post. Which I don’t talk too much about. But do remind you from time to time that I do. I will say about the one at the start of the week is that I introduced a student to Star Realms and deckbuilding. We spent the session playing that game. It was just “one more game” from the student at the end of each one. Plus when I told the student there was an app. They were going to go on Steam to buy it that evening. So I think that was a success. It’s nice to see a student enjoy a game so much they get it for themselves.

Now on with the post and the words I’ve been struggling to write…

Everyone, and I mean everyone whose anyone in the boardgame social media world has done their top 100 games of all time or their top ten this or top five that. From time to time you also get a similar thing on Instagram (see screen grab below).


I’ve tried those sort of posts myself the odd time in the past. I’m not a big fan of them in reality. I kinda see them as click bait. Which will mean this post and the project I’m going to talk about will not make much sense.

These “my top 100 games (insert year here)” lists kind of interest me. Mainly how do they come up with their list? What process do they use? Now that I have started recording my game plays could I produce a similar list based on the number of plays? Would that be a fair reflection of how much I like the game? Is that a good way to rank games I like? I can see flaws in doing it this way.

Just before Christmas there was a website that went up that tried to help you rank the games in your collection. You uploaded a csv (comma separated file) of your collection. Then it would start a series of random game match ups from your collection, where you decide which is the winner. Eventually after lots of these match ups it ranks the games in your collection.

That process is known as pairwise comparison. And allows you to determine a relative order for a group of items. Which in our case is board games.

So I’ve started a project to create my own little ranking program. I’m using Python 3 to write this little project. Mainly because it is quick to prototype with, has some great libraries for doing stuff like accessing a database, web scraping, reading csv files etc. Plus I need to keep my Python skills fresh.

My initial question for this whole project is “What are my top 100 favorite games?” After this has been completed I will then be able to ask other questions such as “What are my top 5 drafting games?” And I’m sure with the data in place other questions will be asked, and expanded on.

But what have I done so far for this project? Well we all know there are not enough hours in the day to do everything. You can’t be lazy, watch tv, play board games, write a blog, hold down a full time job and do other stuff! In other words I did nothing until recently.

Here is what I have done so far…

I started off with a csv file of my game collection downloaded from the bgg website. Which I then tidied up in Excel. This was mainly removing entries that weren’t games but expansions. In data science terminology I was cleaning my data!

I then wrote a Python program to read in the cleaned up data and put it into a sqlite3 database. For each game in the file the program uses the bgg api to get its details. The program then extracts from the returned results the missing information that I want to use later, such as genre, mechanic, designer, etc. Once it has done that the game is added to the sqlite3 database.

This means I now have an sqlite3 database that holds my game collection on a table with the extra info that I have always felt was missing from the csv bgg provide you with. I can now interrogate the sqlite3 database and get a list of all my dice games, or all the games I own by Eric Lang.

I am currently working on a new program in this project which is the the actual ranking engine.  So far this program connects to the sqlite3 database, finds out the number of games I have and generates two random numbers, and then pulls the games details matching those two numbers. You then get something like the following image:

At the moment I can type something in, and the program will keep coming up with new match ups. However at the moment I do nothing with the answer. That’s the next stage of this ranking engine. I need to store the result in a new table. I’m just getting my head round what the best way is to store the information. Because I am using a two dimensional array (well list in Python, although I might use the numpy library to give me a real array) to store the results, I think the best way to store that is with a blob field type. Which means I will have to serialize the data in the array before storing it in the database.

Once the ranking engine has been finished. It’s onto my data visualization engine. This will be the program that pulls off the results and give me like my top 100 games, or top 10 deckbuilders. I also plan to have it also be able to tell me how many of the bgg hotlist I have played or own.

The nice thing about this project is I can also share the badly written code with my students. So they will have examples of how to connect to a sqlite3 database, or read in a csv file, use a web api and use the xml libraries.

So now that I have bored you with an “overview” of my little project. I will threaten you with a more detailed write up once it is completed.

Leave a Reply

Your email address will not be published. Required fields are marked *