The Wumpus World Experiment (Open-Source)

I took a class on Machine Learning in 2013 during my Bachelors and just like every other class I just studied to get passing marks and haven’t actually had any concepts of different things that were taught except for the names of some concepts like bayesian theorem and wumpus world etc. Later in 2015 when I finish my bachelors degree and got a job as an intern iOS developer, I figured that the best way to learn any new language is think of a small idea and develop that idea in it. Wumpus world was born out of this concept too.

I remember I wanted to learn Core Data concept in iOS so I thought of making Wumpus World and I referred to this link to understand what the game was. However the the original concept was that it was made for AI robots and I wanted to develop something which is more human-centered meaning human beings can play it and it should be challenging too, so I changed a few rules and added some more.

A brief history of The Initial Wumpus World Concept

Wumpus World v1.0 Screens

It was a 4x4 grid all boxes hidden. In a game if you find wumpus it’s +1 point and if you find gold it’s also +1 point meaning if you find both you’ll get 2 points in that game and that is the maximum score you can get in one game. However, if you fall in a pit that will be -1. Your overall score or total score is being stored locally and your overall score can decrease or increase based on the outcome of every game you play. User tap on any box to open it. It happened to me a lot of times when the first box that I tapped was a pit and because there is no was to get a hint at start and you have to go blind while opening the first box, it was kinda annoying and I knew that this is a bad thing and it need to change. In every game there were four pit, one gold and one wumpus monster.

This version taught me a lot of things in iOS like basic Core Data concepts and some really cool math tricks like finding adjacent buttons of a button. After that v1.0 I abandoned it completely, it was just an app in my app store account and no connectivity with internet.

Fast forwarding to November 2018, by now I’ve finished Data Science Short Course in which I’ve learnet Data Science using Python and wanted to make an idea so that I can strengthen my concepts of Data Science skills specially using data for machine learning and artificial intelligence.

The Wumpus World Experiment

I wanted to create something which could be help me learn Machine Learning and Artificial Intelligence. I looked back to some of the apps that I have created just for fun and found that wumpus world can be the one. This was the only project which made sense when I was brainstorming on the type of data I would be generatating.

Wumpus World was a different type of idea because it made sense to me on making a simple machine learning model that can predict an outcome of a game for a user even before they start playing it.

When I was brainstorming and trying to understand the code that I did a few years back in Objective-C for v1.0, I learned that I already have most of the logic of the game developed, I just need to convert that code into swift and add some extra features.

The first goal was to convert game logic to swift with new rules. Second goal was to design a whole new UI keeping in mind the new rules and finally when the app is live make the machine learning model.

So I went into the brainstorming mode and came up with these rules:

  • Every game will have 4 pits, 1 Gold and 1 Wumpus Monster
  • There will be four different wumpus monsters and every game will pick one randomly and four wumpus monsters will have different scores.
  • Finding green wumpus will give you 4 points, red has 3, blue has 2 and yellow has 1 points.
  • If you find gold before you find wumpus it’ll add additional 1 point to your score.
  • Falling in the pit or once started closing the game will deduct 1 from your overall score. However, if you have found gold and then fallen into the pit you’ll get zero points and not -1.
  • When a game start there will be one box automatically open for user giving them a hint to start with.
Screenshot of game logs

After game logic was successfully implemented in Swift 4 using the new defined rules I distributed the next steps as:

  • Ensure all the data is getting stored locally (Core Data)
  • User firebase database → FireStore to store that data online.
  • Use Google Cloud Platform to perform machine learning, AI and other data related tasks for user vs computer (Coming Soon)

Starting with these steps I was finally able to finish the hard part which was to store, retrieve and perform operations on data locally and on firestore. It was Nov 21, 2018 and I came home with a happy face because all that was left is to add how to play and a few other static information. Because now the game was ready to go to the app store and I also made a webpage.

Gameral.com homepage on Nov 21, 2018

Game is available on the App Store

After a rejection they finally approved the app and now it’s available to download.

Data Privacy

I’ll have my personal data available for public to do experiment on but If you are a data person like me who is looking to expand this experiment you can request to get your data only.

At some point we can take consent from user to make the game data public while keeping their personal information private but right now it’s all private.

Data Collection

To learn about the data that the game will be collecting you first need to understand the game.

When you start a new game you see this 4x4 grid with one tile revealed. In this case its an ‘X’ and it means that there is nothing in the adjacent boxes (no gold, no pit, no wumpus) so it’s safe to move to any of the boxes.

When you start a game an array [1…16] is randomized and is spread on this grid. So this random pattern is the first thing that is stored for a game along with other information like which cell was opened for user.

As user moves it record the moves, like how far user has move if the hint was X, and which box he opened it’ll be like a full walk through. For example user journey in this game was [7,8,3,6,11,2,1,5,10] and the game ended because he found Wumpus.

So the initial game pattern and user the pattern user has played the game to win or lose this game.

Imagine if you have thousands of such patterns for one user you can make a pretty good mesh to predict a lot about user.

This was the clicking moment when I realized that this type of data set on this small scale can be used for a lot of things which I might not be thinking at the moment.

Machine Learning, Pattern Matching → Artificial Intelligence

In this step I wanted to figure out what should be the top level predictions that can be made. I decided to convert this task into two steps one small and one big as the small step is something that if the computer is good at I can use some techniques and use them for the main analysis:

  • Predict the first box user will open when he starts a new game.
  • Predict the next box user will open.
  • Predict what is going to happen in a game.

You can learn more about this as you explore the data set on Jupyter Notebook on open-source link of project in the section below.

Open-Source Project

This project is open source, the Jupyter Notebook is available on Github with all of my games dataset that I update from time to time in order to have more and more games data. Feel free to fork it, become contributor or do what you want with that data.

GO TO GITHUB REPOSITORY

VIEW ON KAGGLE

If you want to learn more about the game and the dataset feel free to shoot me an email: talha440 at gmail.