"Using anonymous online interactions, participants first observed a dictator (endowed with $10) transfer an unfair amount of money ($1) to a victim who had no money (Fig. 1a). After witnessing this violation of the fairness norm (Fehr & Fischbacher, 2003), participants could choose to spend any amount of their own endowment ($5) to compel the dictator to give twice that amount to the victim (Fig. 1b). Participants were paid the amount that was left in their endowment after making the decision"

##Task Code

This task allows for three people to play the redistribution game over the internet in real-time, using a html, javascript, and php setup. The code works as outlined below and begins when participants are directed to index.php.

In practice, participants were sat in a computer lab and provided with their subject ID. Their subject ID, which they enter into the web-page, determines who they are interacting with and defines their role in each game. The number of thousands in a participants subject id determines their partners, i.e. 1001-1002-1003 play together, while 63001-63002-63003 play together. (Obviously, participants should not be allowed to see other participants id numbers.)

Adapted versions of this code were created to fix dictator offers, as well as to restrict the participants behavior to helping (only adding $ to victim) or punishing (only removing $ from dictator). <MAKE THESE AVAILABLE TOO?>

Ultimately, while you are welcome to use this code, it is a use-at-your-own-risk situation.

If I were to do this again, I might use the otree.org framework. If you can figure out how to code with python/django, I’d recommend that.

To use this code, you will need to adapt your code to connect to your own mysql server, as described in the requirements.

##Requirements

This task requires a web-server and a mysql database. Sadly, using this code will require you figuring out how to do this on your own.

Your database must follow the schema in: econ_game_schema.sql

The code will need to be adapted to connect to your database, the url for your database should be specified in the $connect_string and replace mysql://XXX in all .php files where it occurs.