CoCalc Public Filestmp / demo.ipynbOpen in with one click!
Authors: Harald Schilly, ℏal Snyder, William A. Stein
In [ ]:
import gambit
In [ ]:
from gambit import Game gambit_game = Game.new_table([2, 2]) gambit_game[0, 0][0] = 8 gambit_game[0, 0][1] = 8 gambit_game[0, 1][0] = 2 gambit_game[0, 1][1] = 10 gambit_game[1, 0][0] = 10 gambit_game[1, 0][1] = 2 gambit_game[1, 1][0] = 5 gambit_game[1, 1][1] = 5 gambitgame
In [ ]:
solver = gambit.nash.ExternalEnumPureSolver() solver.solve(gambitgame)
In [ ]:
output = open('game.nfg', 'w') output.write(gambitgame.write('nfg')) output.close()
In [ ]:
gambit_game = gambit.Game.read_game("game.nfg")
In [ ]:
gambit_game
In [ ]: