Single_Player_Chess/template.html

90 lines
2.0 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-width: 0pt 0pt 0pt 0pt;
}
td {
2019-09-10 21:52:38 +02:00
width: 24pt;
height: 24pt;
border-collapse: collapse;
border-color: black;
border-style: solid;
border-width: 0pt 0pt 0pt 0pt
2019-09-10 18:48:06 +02:00
}
span {
font-size: 150%;
}
2019-09-10 21:52:38 +02:00
input[type="text"] {
width: 60px;
}
2019-09-10 18:48:06 +02:00
</style>
</head>
<body>
2019-09-10 21:52:38 +02:00
<div align="center">
2019-09-10 18:48:06 +02:00
<table>
<tbody>
% ranks = "87654321"
2019-09-10 21:52:38 +02:00
% #ranks = ranks if game.turn=="white" else ranks[::-1]
2019-09-10 18:48:06 +02:00
% 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>
2019-09-10 21:52:38 +02:00
<form method="post">
% first = "disabled" if game.index < 2 else ""
% prev = "disabled" if game.index == 0 else ""
% next = "disabled" if game.index+1 == len(game.history) else ""
% last = "disabled" if game.index+2 >= len(game.history) else ""
<input type="submit" name="first" value="{{"<<"}}" {{first}}>
<input type="submit" name="prev" value="{{"<"}}" {{prev}}>
<input type="submit" name="next" value="{{">"}}" {{next}}>
<input type="submit" name="last" value="{{">>"}}" {{last}}>
</form>
2019-09-10 18:48:06 +02:00
<form method="post">
% if not game.endofgame():
2019-09-11 01:13:10 +02:00
<input type="text" name="move" autofocus="autofocus">
2019-09-10 18:48:06 +02:00
<input type="submit" value="Move">
% end
</form>
2019-09-10 21:52:38 +02:00
2019-09-11 01:10:53 +02:00
<form method="post">
<input type="submit" name="newgame" value="New Game">
</form>
2019-09-10 21:52:38 +02:00
</div>
2019-09-10 18:48:06 +02:00
</body>
</html>