@@ -48,7 +48,7 @@ We can then also add the Seller's move in the situation after the Buyer chooses
4848
4949.. ipython :: python
5050
51- g.append_move(g.root.children[0 ], " Seller" , [" Honor" , " Abuse" ])
51+ g.append_move(g.root.children[" Trust " ], " Seller" , [" Honor" , " Abuse" ])
5252
5353 Now that we have the moves of the game defined, we add payoffs. Payoffs are associated with
5454an :py:class: `.Outcome `; each :py:class: `Outcome ` has a vector of payoffs, one for each player,
@@ -57,20 +57,20 @@ Seller proving themselves trustworthy:
5757
5858.. ipython :: python
5959
60- g.set_outcome(g.root.children[0 ].children[0 ], g.add_outcome([1 , 1 ], label = " Trustworthy" ))
60+ g.set_outcome(g.root.children[" Trust " ].children[" Honor " ], g.add_outcome([1 , 1 ], label = " Trustworthy" ))
6161
6262 Next, the outcome associated with the scenario where the Buyer trusts but the Seller does
6363not return the trust:
6464
6565.. ipython :: python
6666
67- g.set_outcome(g.root.children[0 ].children[1 ], g.add_outcome([- 1 , 2 ], label = " Untrustworthy" ))
67+ g.set_outcome(g.root.children[" Trust " ].children[" Abuse " ], g.add_outcome([- 1 , 2 ], label = " Untrustworthy" ))
6868
6969 And, finally the outcome associated with the Buyer opting out of the interaction:
7070
7171.. ipython :: python
7272
73- g.set_outcome(g.root.children[1 ], g.add_outcome([0 , 0 ], label = " Opt-out" ))
73+ g.set_outcome(g.root.children[" Not trust " ], g.add_outcome([0 , 0 ], label = " Opt-out" ))
7474
7575 Nodes without an outcome attached are assumed to have payoffs of zero for all players.
7676Therefore, adding the outcome to this latter terminal node is not strictly necessary in Gambit,
@@ -111,19 +111,19 @@ We can build this game using the following script::
111111 g.append_move(g.root, g.players.chance, ["King", "Queen"])
112112 for node in g.root.children:
113113 g.append_move(node, "Alice", ["Raise", "Fold"])
114- g.append_move(g.root.children[0 ].children[0 ], "Bob", ["Meet", "Pass"])
115- g.append_infoset(g.root.children[1 ].children[0 ],
116- g.root.children[0 ].children[0 ].infoset)
114+ g.append_move(g.root.children["King" ].children["Raise" ], "Bob", ["Meet", "Pass"])
115+ g.append_infoset(g.root.children["Queen" ].children["Raise" ],
116+ g.root.children["King" ].children["Raise" ].infoset)
117117 alice_winsbig = g.add_outcome([2, -2], label="Alice wins big")
118118 alice_wins = g.add_outcome([1, -1], label="Alice wins")
119119 bob_winsbig = g.add_outcome([-2, 2], label="Bob wins big")
120120 bob_wins = g.add_outcome([-1, 1], label="Bob wins")
121- g.set_outcome(g.root.children[0 ].children[0 ].children[0 ], alice_winsbig)
122- g.set_outcome(g.root.children[0 ].children[0 ].children[1 ], alice_wins)
123- g.set_outcome(g.root.children[0 ].children[1 ], bob_wins)
124- g.set_outcome(g.root.children[1 ].children[0 ].children[0 ], bob_winsbig)
125- g.set_outcome(g.root.children[1 ].children[0 ].children[1 ], alice_wins)
126- g.set_outcome(g.root.children[1 ].children[1 ], bob_wins)
121+ g.set_outcome(g.root.children["King" ].children["Raise" ].children["Meet" ], alice_winsbig)
122+ g.set_outcome(g.root.children["King" ].children["Raise" ].children["Pass" ], alice_wins)
123+ g.set_outcome(g.root.children["King" ].children["Fold" ], bob_wins)
124+ g.set_outcome(g.root.children["Queen" ].children["Raise" ].children["Meet" ], bob_winsbig)
125+ g.set_outcome(g.root.children["Queen" ].children["Raise" ].children["Pass" ], alice_wins)
126+ g.set_outcome(g.root.children["Queen" ].children["Fold" ], bob_wins)
127127
128128All extensive games have a chance (or nature) player, accessible as
129129``.Game.players.chance ``. Moves belonging to the chance player can be added in the same
@@ -140,9 +140,9 @@ causes each of the newly-appended moves to be in new information sets. In contr
140140does not know Alice's card, and therefore cannot distinguish between the two nodes at which
141141he has the decision. This is implemented in the following lines::
142142
143- g.append_move(g.root.children[0 ].children[0 ], "Bob", ["Meet", "Pass"])
144- g.append_infoset(g.root.children[1 ].children[0 ],
145- g.root.children[0 ].children[0 ].infoset)
143+ g.append_move(g.root.children["King" ].children["Raise" ], "Bob", ["Meet", "Pass"])
144+ g.append_infoset(g.root.children["Queen" ].children["Raise" ],
145+ g.root.children["King" ].children["Raise" ].infoset)
146146
147147The call :py:meth: `.Game.append_infoset ` adds a move at a terminal node as part of
148148an existing information set (represented in ``pygambit `` as an :py:class: `.Infoset `).
0 commit comments