This repository contains the code for an online modified prisoner's dilemma game created for an experiment completed at the William and Mary Cross-cultural Cognition Lab.
These instructions are for getting a copy of the project working locally for development and testing.
- Install Node.js.
- Install npm
- Install Nodemon by typing
npm install -g nodemon
Type node -v
and npm -v
into a terminal or console to verify that you're running at least
node v4.x.x
and npm 3.x.x
.
-
Create a new project folder (named
game-pd
, for example) and clone this repo into it by typing the following command:git clone https://github.com/xzou/cooperation-mturk-study game-pd
. -
Navigate into the project folder by typing
cd game-pd
(or whatever your folder is named) and typenpm install
to install the npm packages listed in thepackage.json
. -
Type
ng build --watch
. -
Open up a new terminal window or tab, and again navigate into the project directory. Type
nodemon server.js
You should see a message likeListening on port 8080
. -
Open up a browser, and go to the URL
localhost:8080
(or whichever port was indicated in the message).
Navigate to the directory containing most of the game's logic by typing cd src/app/pd-game
from the project's root directory.
Open the file called game.service.ts
to change the condition number (1, 2, or 3) and the initial probability of
cooperation (between 0 and 1).