tictactoecss/tictactoe.py

30 lines
811 B
Python
Raw Normal View History

from jinja2 import Environment, FileSystemLoader
from bot import get_sudoku_moves
def write_html(html_file):
env = Environment(loader=FileSystemLoader("."))
template = env.get_template('template.' + html_file)
with open(html_file, 'w') as f:
f.write(template.render())
def write_css(css_file):
moves, draws, wins2 = get_sudoku_moves()
kwargs = {
"turns_player": [0, 2, 4, 6, 8],
"turns_bot": [1, 3, 5, 7],
"moves": moves,
"draws": draws,
"wins2": wins2,
}
env = Environment(loader=FileSystemLoader("."))
template = env.get_template('template.' + css_file)
with open(css_file, 'w') as f:
f.write(template.render(**kwargs))
if __name__ == "__main__":
write_html("tictactoe.html")
write_css("tictactoe.css")