html-tictactoe/generator/template.html

54 lines
1.3 KiB
HTML
Raw Permalink Normal View History

2024-10-23 21:05:10 +00:00
<!DOCTYPE html>
<html>{{- "" -}}
<head>{{- "" -}}
<title>HTML-only Tic-Tac-Toe</title>{{- "" -}}
2024-10-23 21:09:07 +00:00
</head>{{- "" -}}
2024-10-23 21:05:10 +00:00
<body>{{- "" -}}
2024-10-23 21:09:07 +00:00
2024-10-23 21:05:10 +00:00
<h1>HTML-only Tic-Tac-Toe</h1>{{- "" -}}
<h2>Yes, really.</h2>{{- "" -}}
{%- set winner = board.winner() -%}
<h3>{{ msg }}</h3>{{- "" -}}
2024-10-25 16:12:25 +00:00
2024-10-23 21:09:07 +00:00
<a href={{ reset }}>Start over</a>{{- "" -}}
<br /><br />{{- "" -}}
<table border=1 cellpadding=10>{{- "" -}}
2024-10-23 21:05:10 +00:00
{%- for y in range(3) -%}
<tr>
{%- for x in range(3) -%}
<td>
{%- set cell = board.field[y][x] -%}
{%- if cell != 0 -%}
2024-10-23 21:09:07 +00:00
{{- 'X' if cell == 1 else 'O' -}}
2024-10-23 21:05:10 +00:00
{%- elif winner != -1 -%}
2024-10-23 21:09:07 +00:00
&nbsp;
2024-10-23 21:05:10 +00:00
{%- else -%}
<a href={{ prefix }}{{ board.apply(Move(x, y)).get_id() }}.html>?</a>
2024-10-23 21:05:10 +00:00
{%- endif -%}
</td>
{%- endfor -%}
</tr>
{%- endfor -%}
</table>
{{- "" -}}
{%- if winner != -1 -%}
2024-10-23 21:09:07 +00:00
{%- 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>
2024-10-23 21:05:10 +00:00
{%- endif -%}
<hr />{{- "" -}}
<a href="https://github.com/sigmasternchen/html-tictactoe">Source Code</a>{{- "" -}}
2024-10-23 21:09:07 +00:00
</body>{{- "" -}}
2024-10-25 16:12:25 +00:00
</html>