Skip to content

Commit 47ae84c

Browse files
committed
fix doctest warnings in src/sage/game_theory/parser.py
1 parent 5ce7339 commit 47ae84c

File tree

1 file changed

+48
-43
lines changed

1 file changed

+48
-43
lines changed

src/sage/game_theory/parser.py

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,19 @@ def format_gambit(self, gambit_game):
194194
195195
Here we construct a two by two game in gambit::
196196
197-
sage: import gambit # optional - gambit
197+
sage: # optional - gambit
198+
sage: import gambit
198199
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()
209210
210211
Here is the output of the LCP algorithm::
211212
@@ -218,21 +219,24 @@ def format_gambit(self, gambit_game):
218219
The Parser class outputs the equilibrium::
219220
220221
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)]]
223226
224227
Here is another game::
225228
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()
236240
237241
Here is the LCP output::
238242
@@ -248,26 +252,27 @@ def format_gambit(self, gambit_game):
248252
249253
Here is a larger degenerate game::
250254
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()
271276
272277
Here is the LCP output::
273278

0 commit comments

Comments
 (0)