html-tictactoe/generator/template.html

53 lines
1.3 KiB
HTML

<!DOCTYPE html>
<html>{{- "" -}}
<head>{{- "" -}}
<title>HTML-only Tic-Tac-Toe</title>{{- "" -}}
</head>{{- "" -}}
<body>{{- "" -}}
<h1>HTML-only Tic-Tac-Toe</h1>{{- "" -}}
<h2>Yes, really.</h2>{{- "" -}}
{%- set winner = board.winner() -%}
<h3>{{ msg }}</h3>{{- "" -}}
<a href={{ reset }}>Start over</a>{{- "" -}}
<br /><br />{{- "" -}}
<table border=1 cellpadding=10>{{- "" -}}
{%- for y in range(3) -%}
<tr>
{%- for x in range(3) -%}
<td>
{%- set cell = board.field[y][x] -%}
{%- if cell != 0 -%}
{{- 'X' if cell == 1 else 'O' -}}
{%- elif winner != -1 -%}
&nbsp;
{%- else -%}
<a href={{ prefix }}{{ board.apply(Move(x, y)).get_id() }}.html>?</a>
{%- endif -%}
</td>
{%- endfor -%}
</tr>
{%- endfor -%}
</table>
{{- "" -}}
{%- if winner != -1 -%}
{%- if winner == 0 -%}
<h3>Draw</h3>
{%- elif winner == 1 -%}
<h3>You won! (How??)</h3>
{%- elif winner == 2 -%}
<h3>You lost!</h3>
<h4>... At Tic-Tac-Toe...</h4>
<h5>... Against HTML...</h5>
{%- endif -%}
<a href={{ reset }}>Try again!</a>
{%- endif -%}
<hr />{{- "" -}}
<a href="https://github.com/sigmasternchen/html-tictactoe">Source Code</a>{{- "" -}}
</body>{{- "" -}}
</html>