-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaper examples.boxs
97 lines (81 loc) · 2.76 KB
/
paper examples.boxs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// set the number of rounds - ATTENTION: this variable (including 'i') will not be seen inside
rounds = 10
// play the game
for (i=1; i<=rounds; i=i+1)
{
// match 4 players each round
matchStranger(A,B,C,D)
// present instructions and mood induction in the first round
if (i==1)
{
// instructions
display("<h1>Public Good Game</h1><hr>")
display("Endowment: 20 Talers")
display("Players per Group: 4")
display("Contribution: 0-20 Talers (whole numbers)")
display("Payoff factor: 0.4 (")
display("<br><img src='http://chart.apis.google.com/chart?cht=tx&chl=p_i=10%20-%20z_i%20%2B%20%200.4%20%20\cdot%20\sum_i{z_i}'>")
wait()
// start the eyetracker for player S1 (or for more if wished)
if (username == "S1")
{
// init eyetracker
eyetrackerInitialise("localhost",4444,5555)
display("The calibration begins by pushing the wait button")
wait()
display("<h1>Please hold still and follow the appearing Calibration points.</h1>")
wait()
// calibrate eyetracker and start tracking
eyetrackerCalibrate()
display("Thank you - the calibration was successful")
filename = "PrisonersDilemma_" + vpnumber + ".dat"
eyetrackerStart(60,filename)
// send trigger
eyetrackerTrigger("Calibration Done")
wait()
}
// Mood induction Video
display("<img src='file:///Users/hans/Downloads/out.gif'</img>")
wait(100000)
}
// measure the time when stage is shown
beginTime = time
// Read how much the subjects want to contribute and store it in z
display("<br>Please choose the amount you would like to contribute:")
inputNumber(z)
// check for consistent input
assert(z>=0 && z<=10 && z==round(z))
// wait until all players entered their respective contribution
waitForPlayers()
// inform the subjects about the results of the experiment
display("You are player "+role+". You contributed <b>"+z+" Talers</b>. <br>The total amount donated is <b>"+sum(z)+" Talers</b>.")
display("<img src='http://chart.apis.google.com/chart?cht=p&chd=t:"+A.z+","+B.z+","+C.z+","+D.z+"&chs=200x150&chl=A|B|C|D'>")
// Calculate the payoff for each subject
payoff = 10 - z + 0.4*sum(z)
// players overall payoff
payoffAll = payoffAll + payoff
// players decision
results[i][0] = z
// length of players decision making in ms
results[i][1] = time - begintime
// players payoff
results[i][2] = payoff
// overall payoff
results[i][3] = payoffAll
// Inform the subjects about their payoff
display("Your payoff is <b>"+payoff+" Talers</b>")
wait()
if (i == 10)
{
// stop the eyetracker for player S1 (or for more if wished)
if (username == "S1")
{
eyetrackerStop()
display("Eyetracker stopped")
}
// show payoff for all rounds
display("Your overall payoff is <b>"+payoffAll+" Talers</b>")
waitForExperimenter()
}
matchDone()
}