Skip to content

Commit

Permalink
Fix bug with Game.write for 'gte' format
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhijeetKrishnan authored and tturocy committed Nov 9, 2023
1 parent 90bbf7c commit 3ff06e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pygambit/gte.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ def read_game(f):


def write_game_outcome(game, outcome, doc, xml_parent):
for (i, p) in enumerate(game.players):
for p in game.players:
if outcome is not None:
etree.SubElement(xml_parent, "payoff",
player=p.label).text = str(outcome[i])
player=p.label).text = str(outcome[p])
else:
etree.SubElement(xml_parent, "payoff",
player=p.label).text = "0"
Expand Down
4 changes: 4 additions & 0 deletions src/pygambit/tests/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def test_parse_string_extra_payoff(self):
"Parse error in game file: line 5:29: Expecting '}' after outcome"
)

def test_write_game_gte_sanity(self):
g = pygambit.Game.parse_game(self.file_text)
g.write('gte')


class TestGambitNfgFile(unittest.TestCase):
def setUp(self):
Expand Down

0 comments on commit 3ff06e2

Please sign in to comment.