diff --git a/src/games/writer.cc b/src/games/writer.cc index 744f3efad..3cc882e9c 100644 --- a/src/games/writer.cc +++ b/src/games/writer.cc @@ -52,18 +52,35 @@ std::string WriteHTMLFile(const Game &p_game, const GamePlayer &p_rowPlayer, theHtml += ""; theHtml += ""; - theHtml += ""; + theHtml += R"()"; + theHtml += R"("; + theHtml += ""; + theHtml += ""; for (const auto &strategy : p_colPlayer->GetStrategies()) { - theHtml += ""; } theHtml += ""; + + bool first_row_strategy = true; for (const auto &row_strategy : p_rowPlayer->GetStrategies()) { const PureStrategyProfile profile = iter; profile->SetStrategy(row_strategy); theHtml += ""; - theHtml += ""; + first_row_strategy = false; + } + + theHtml += R"("; for (const auto &col_strategy : p_colPlayer->GetStrategies()) { diff --git a/tests/test_io.py b/tests/test_io.py index 3016c224b..da3043502 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -101,8 +101,12 @@ def test_write_efg_as_nfg(): def test_write_html(): game = gbt.Game.new_table([2, 2]) + game.players[0].label = "Alice" + game.players[1].label = "Bob" serialized_game = game.to_html() assert isinstance(serialized_game, str) + assert "Alice" in serialized_game + assert "Bob" in serialized_game def test_write_latex():
GetStrategies().size()) + + R"(" align="center">)"; + theHtml += p_colPlayer->GetLabel(); + theHtml += "
"; + theHtml += R"()"; theHtml += strategy->GetLabel(); theHtml += "
"; + + if (first_row_strategy) { + theHtml += R"(GetStrategies().size()) + + R"(" align="center" valign="middle">)"; + theHtml += p_rowPlayer->GetLabel(); + theHtml += ")"; theHtml += row_strategy->GetLabel(); theHtml += "