@@ -194,18 +194,19 @@ def format_gambit(self, gambit_game):
194
194
195
195
Here we construct a two by two game in gambit::
196
196
197
- sage: import gambit # optional - gambit
197
+ sage: # optional - gambit
198
+ sage: import gambit
198
199
sage: from sage.game_theory.parser import Parser
199
- sage: g = gambit.Game.new_table([2,2]) # optional - gambit
200
- sage: g[int(0), int(0)][int(0)] = int(2) # optional - gambit
201
- sage: g[int(0), int(0)][int(1)] = int(1) # optional - gambit
202
- sage: g[int(0), int(1)][int(0)] = int(0) # optional - gambit
203
- sage: g[int(0), int(1)][int(1)] = int(0) # optional - gambit
204
- sage: g[int(1), int(0)][int(0)] = int(0) # optional - gambit
205
- sage: g[int(1), int(0)][int(1)] = int(0) # optional - gambit
206
- sage: g[int(1), int(1)][int(0)] = int(1) # optional - gambit
207
- sage: g[int(1), int(1)][int(1)] = int(2) # optional - gambit
208
- sage: solver = gambit.nash.ExternalLCPSolver() # optional - gambit
200
+ sage: g = gambit.Game.new_table([2,2])
201
+ sage: g[int(0), int(0)][int(0)] = int(2)
202
+ sage: g[int(0), int(0)][int(1)] = int(1)
203
+ sage: g[int(0), int(1)][int(0)] = int(0)
204
+ sage: g[int(0), int(1)][int(1)] = int(0)
205
+ sage: g[int(1), int(0)][int(0)] = int(0)
206
+ sage: g[int(1), int(0)][int(1)] = int(0)
207
+ sage: g[int(1), int(1)][int(0)] = int(1)
208
+ sage: g[int(1), int(1)][int(1)] = int(2)
209
+ sage: solver = gambit.nash.ExternalLCPSolver()
209
210
210
211
Here is the output of the LCP algorithm::
211
212
@@ -218,21 +219,24 @@ def format_gambit(self, gambit_game):
218
219
The Parser class outputs the equilibrium::
219
220
220
221
sage: nasheq = Parser(LCP_output).format_gambit(g) # optional - gambit
221
- sage: nasheq # optional - gambit
222
- [[(1.0, 0.0), (1.0, 0.0)], [(0.6666666667, 0.3333333333), (0.3333333333, 0.6666666667)], [(0.0, 1.0), (0.0, 1.0)]]
222
+ sage: nasheq # optional - gambit
223
+ [[(1.0, 0.0), (1.0, 0.0)],
224
+ [(0.6666666667, 0.3333333333), (0.3333333333, 0.6666666667)],
225
+ [(0.0, 1.0), (0.0, 1.0)]]
223
226
224
227
Here is another game::
225
228
226
- sage: g = gambit.Game.new_table([2,2]) # optional - gambit
227
- sage: g[int(0), int(0)][int(0)] = int(4) # optional - gambit
228
- sage: g[int(0), int(0)][int(1)] = int(8) # optional - gambit
229
- sage: g[int(0), int(1)][int(0)] = int(0) # optional - gambit
230
- sage: g[int(0), int(1)][int(1)] = int(1) # optional - gambit
231
- sage: g[int(1), int(0)][int(0)] = int(1) # optional - gambit
232
- sage: g[int(1), int(0)][int(1)] = int(3) # optional - gambit
233
- sage: g[int(1), int(1)][int(0)] = int(1) # optional - gambit
234
- sage: g[int(1), int(1)][int(1)] = int(0) # optional - gambit
235
- sage: solver = gambit.nash.ExternalLCPSolver() # optional - gambit
229
+ sage: # optional - gambit
230
+ sage: g = gambit.Game.new_table([2,2])
231
+ sage: g[int(0), int(0)][int(0)] = int(4)
232
+ sage: g[int(0), int(0)][int(1)] = int(8)
233
+ sage: g[int(0), int(1)][int(0)] = int(0)
234
+ sage: g[int(0), int(1)][int(1)] = int(1)
235
+ sage: g[int(1), int(0)][int(0)] = int(1)
236
+ sage: g[int(1), int(0)][int(1)] = int(3)
237
+ sage: g[int(1), int(1)][int(0)] = int(1)
238
+ sage: g[int(1), int(1)][int(1)] = int(0)
239
+ sage: solver = gambit.nash.ExternalLCPSolver()
236
240
237
241
Here is the LCP output::
238
242
@@ -248,26 +252,27 @@ def format_gambit(self, gambit_game):
248
252
249
253
Here is a larger degenerate game::
250
254
251
- sage: g = gambit.Game.new_table([3,3]) # optional - gambit
252
- sage: g[int(0), int(0)][int(0)] = int(-7) # optional - gambit
253
- sage: g[int(0), int(0)][int(1)] = int(-9) # optional - gambit
254
- sage: g[int(0), int(1)][int(0)] = int(-5) # optional - gambit
255
- sage: g[int(0), int(1)][int(1)] = int(7) # optional - gambit
256
- sage: g[int(0), int(2)][int(0)] = int(5) # optional - gambit
257
- sage: g[int(0), int(2)][int(1)] = int(9) # optional - gambit
258
- sage: g[int(1), int(0)][int(0)] = int(5) # optional - gambit
259
- sage: g[int(1), int(0)][int(1)] = int(6) # optional - gambit
260
- sage: g[int(1), int(1)][int(0)] = int(5) # optional - gambit
261
- sage: g[int(1), int(1)][int(1)] = int(-2) # optional - gambit
262
- sage: g[int(1), int(2)][int(0)] = int(3) # optional - gambit
263
- sage: g[int(1), int(2)][int(1)] = int(-3) # optional - gambit
264
- sage: g[int(2), int(0)][int(0)] = int(1) # optional - gambit
265
- sage: g[int(2), int(0)][int(1)] = int(-4) # optional - gambit
266
- sage: g[int(2), int(1)][int(0)] = int(-6) # optional - gambit
267
- sage: g[int(2), int(1)][int(1)] = int(6) # optional - gambit
268
- sage: g[int(2), int(2)][int(0)] = int(1) # optional - gambit
269
- sage: g[int(2), int(2)][int(1)] = int(-10) # optional - gambit
270
- sage: solver = gambit.nash.ExternalLCPSolver() # optional - gambit
255
+ sage: # optional - gambit
256
+ sage: g = gambit.Game.new_table([3,3])
257
+ sage: g[int(0), int(0)][int(0)] = int(-7)
258
+ sage: g[int(0), int(0)][int(1)] = int(-9)
259
+ sage: g[int(0), int(1)][int(0)] = int(-5)
260
+ sage: g[int(0), int(1)][int(1)] = int(7)
261
+ sage: g[int(0), int(2)][int(0)] = int(5)
262
+ sage: g[int(0), int(2)][int(1)] = int(9)
263
+ sage: g[int(1), int(0)][int(0)] = int(5)
264
+ sage: g[int(1), int(0)][int(1)] = int(6)
265
+ sage: g[int(1), int(1)][int(0)] = int(5)
266
+ sage: g[int(1), int(1)][int(1)] = int(-2)
267
+ sage: g[int(1), int(2)][int(0)] = int(3)
268
+ sage: g[int(1), int(2)][int(1)] = int(-3)
269
+ sage: g[int(2), int(0)][int(0)] = int(1)
270
+ sage: g[int(2), int(0)][int(1)] = int(-4)
271
+ sage: g[int(2), int(1)][int(0)] = int(-6)
272
+ sage: g[int(2), int(1)][int(1)] = int(6)
273
+ sage: g[int(2), int(2)][int(0)] = int(1)
274
+ sage: g[int(2), int(2)][int(1)] = int(-10)
275
+ sage: solver = gambit.nash.ExternalLCPSolver()
271
276
272
277
Here is the LCP output::
273
278
0 commit comments