Single_Player_Chess/template.html

70 lines
1.4 KiB
HTML
Raw Normal View History

2019-09-10 18:48:06 +02:00
<html>
<head>
<style>
table {
text-align: center;
border-spacing: 0pt;
font-family: 'Arial Unicode MS';
border-collapse: collapse;
border-color: black;
border-style: solid;
border-width: 0pt 0pt 0pt 0pt;
}
td {
width: 24pt;
height: 24pt;
border-collapse: collapse;
border-color: black;
border-style: solid;
border-width: 0pt 0pt 0pt 0pt
}
span {
font-size: 150%;
}
</style>
</head>
<body>
<table>
<tbody>
% ranks = "87654321"
% ranks = ranks if game.turn=="white" else ranks[::-1]
% files = "abcdefgh"
% is_black = lambda x: (ord(x[0])-ord('a')) % 2 != int(x[1]) % 2
% for i, rank in enumerate(ranks):
<tr>
<td style="width:12pt;">{{rank}}</td>
% for file in files:
% sq = file + rank
% color = 'bgcolor=silver' if is_black(sq) else ""
% widths = i==0, file=='h', i==7, file=='a'
% widths = "pt ".join(map(str, map(int, widths))) + "pt"
<td {{color}} style="border-width:{{widths}};"><span>{{game.board[sq]}}</span></td>
% end
</tr>
% end
<tr>
<td></td>
% for file in files:
<td>{{file}}</td>
% end
</tr>
</tbody>
</table>
<form method="post">
% if not game.endofgame():
<input type="text" name="move">
<input type="submit" value="Move">
% else:
<input type="submit" name="new" value="New Game">
% end
</form>
</body>
</html>