% 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): % 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" % end % end % for file in files: % end
{{rank}}{{game.board[sq]}}
{{file}}
% if not game.endofgame(): % else: % end