Skip to content

Board.__str__ including grid labels #971

Description

@jamesbraza

To me, it's easier to see/understand a board's printed representation with the rank/file shown.

In [1]: import chess
In [2]: board = chess.Board()
In [3]: print(board)
r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
R N B Q K B N R

It would be nice to support the ability to show the grid:

In [4]: print(board.grid())
  | a b c d e f g h
- + ---------------
8 | r n b q k b n r
7 | p p p p p p p p
6 | . . . . . . . .
5 | . . . . . . . .
4 | . . . . . . . .
3 | . . . . . . . .
2 | P P P P P P P P
1 | R N B Q K B N R

Alternately, an instance attribute verbose could be added that somehow enables behaviors like this when __str__ is invoked.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions