Skip to content

Commit 668d743

Browse files
Add visualization column for tikz code
1 parent ef0ed7f commit 668d743

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

build_support/catalog/update.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pathlib import Path
33

44
import pandas as pd
5+
from draw_tree import draw_tree
56

67
import pygambit as gbt
78

@@ -15,15 +16,19 @@ def generate_rst_table(df: pd.DataFrame, rst_path: Path):
1516
with open(rst_path, "w", encoding="utf-8") as f:
1617
f.write(".. list-table::\n")
1718
f.write(" :header-rows: 1\n")
18-
f.write(" :widths: 20 80 20\n")
19+
f.write(" :widths: 15 45 30 10\n")
1920
f.write(" :class: tight-table\n")
2021
f.write("\n")
2122

2223
f.write(" * - **Game**\n")
2324
f.write(" - **Description**\n")
25+
f.write(" - **Visualization**\n")
2426
f.write(" - **Download**\n")
2527

2628
for _, row in df.iterrows():
29+
g = gbt.catalog.load(row["Game"])
30+
tikz = draw_tree(g)
31+
2732
f.write(f" * - {row['Game']}\n")
2833

2934
description_cell_lines = []
@@ -41,6 +46,11 @@ def generate_rst_table(df: pd.DataFrame, rst_path: Path):
4146
for line in description_cell_lines[1:]:
4247
f.write(f" {line}\n")
4348

49+
f.write(f" - .. tikz:: {row['Game']}\n")
50+
f.write(" \n")
51+
for line in tikz.splitlines():
52+
f.write(f" {line}\n")
53+
4454
f.write(f" - {row['Download']}\n")
4555

4656

@@ -96,7 +106,6 @@ def update_makefile():
96106

97107

98108
if __name__ == "__main__":
99-
100109
parser = argparse.ArgumentParser()
101110
parser.add_argument("--build", action="store_true")
102111
args = parser.parse_args()

0 commit comments

Comments
 (0)