修改棋盘格式用于对齐

This commit is contained in:
2025-10-28 17:57:02 +08:00
parent 7d28e2e2aa
commit 57f955f837
2 changed files with 18 additions and 4 deletions

View File

@@ -252,9 +252,9 @@ def render_board(board: List[List[int]], last_move: Optional[Tuple[int, int]] =
"""
lines = []
# 列标题
col_labels = " " + " ".join([chr(ord('A') + i) for i in range(15)])
lines.append(col_labels)
# 列标题 - 使用全角空格确保对齐
col_labels = " " + "".join([chr(ord('A') + i) + " " for i in range(15)])
lines.append(col_labels.rstrip())
# 绘制棋盘
for row in range(15):
@@ -280,7 +280,8 @@ def render_board(board: List[List[int]], last_move: Optional[Tuple[int, int]] =
elif cell == 2:
row_cells.append("")
lines.append(f" {row_num} {' '.join(row_cells)}")
# 每个emoji后面加一个空格
lines.append(f"{row_num} " + "".join([cell + " " for cell in row_cells]).rstrip())
return "\n".join(lines)