In the Editor sidebar, look under the collapsible panel called Node properties. When you select a terminal node in the game tree, this panel will let you change the terminal node’s properties.
A terminal node is where the game ends and each player gets a payoff. Since every game must end with players getting payoffs, every path through the game tree must end in a terminal node.
A player’s payoffs can depend on the path through the game tree and the node itself (perhaps obviously) and the private information of all of the players. For example, consider a path through a game tree where an instigator player acted aggressively and a victim player defended aggressively. The victim’s private information is that he either has a knife or a gun. The instigator’s private information is that his gun is either real or fake. Perhaps the players both lose a lot if the instigator’s gun is real and the victim has a gun too. Perhaps the instigator loses a little and the victim doesn’t lose much if the instigator’s gun is fake and the victim has a knife. At each terminal node, the payoffs have to be defined for every combination of private information among the players.
Since it’s possible to imagine payoff nodes becoming quite complex, and it makes sense to enable full versatility for the payoff function, the format for defining payoffs is literally a JavaScript function. The JavaScript function is evaluated by the calculator using in a JavaScript sandbox. The payoff should have the following signature:
function payoff(player, privates, sequence) {
// ...
}
The arguments are as follows:
["Weak", "1000"]
.[0, 1]
. Note that you may not need to use this argument in your function, but it is provided as a convenience.Below is an example payoff function for the instigator/victim node described earlier. This is a pretty grim game since the payoffs are all negative!
function payoff(player, privates, sequence) {
if (privates[0] === "Real gun") {
if (privates[1] === "Knife") {
return player === 0 ? -2 : -10;
} else if (privates[1] === "Gun") {
return player === 0 ? -100 : -100;
}
} else if (privates[1] === "Fake gun") {
if (privates[1] === "Knife") {
return player === 0 ? -10 : -1;
} else if (privates[1] === "Gun") {
return player === 0 ? -100 : -5;
}
}
}
Remember to press the Save button any time you make changes to this panel. Otherwise, your changes will not be applied to the game tree.