Ultimatum Game Fork


The ultimatum game is a JavaScript game I wrote for an independent study at Northeastern University. In essence, it's a version of the classic ultimatum game able to accomodate an arbitrary number of players. It was developed for a not-yet-released sociological gaming platform that allows researchers to run experiments online.

Ultimatum Game screenshot

This version of the ultimatum game is played as follows: each game picks a player at random to be the choosing player. That player gets a certain number of points, configurable by the researcher. That player can then divvy the number of points between all participating players as they like. After that player has finished, all other players either accept or reject their offers. If the percentage that accepts is above a configurable percentage, then all players receive their points. Otherwise, no one receives any points.

The first aim of this game in an online experimental setting would be to replicate the results of the classic ultimatum game. This would verify that the principles of the in-person ultimatum game between two people still hold. Assuming the results are replicated successfully, the next step would be to run the experiment with several people instead of just two to see how the participants act. At this point, there are many experimental variables that could be altered. To avoid boring the uninterested reader, these next steps can be viewed in the "future work" section of the paper I wrote.

The entire game is written in JavaScript and can be viewed here. Although the API I was given for interacting with the platform was a horrendous mess of global variables and functions, I made the best of it and had a fun time coding it. As you can see from the code, I was able to architect it rather nicely, keeping the game logic separate from the platform API logic with proper models and views using client-side templating. I also had the chance to improve the API slightly, as well, by first fully documenting it (which no one had done before), fixing a critical security vulnerability with Django templates, and adding a callback argument to one of the API functions.

For both my contributions to the platform as well as my development of this game, I got an A. :D