The gomill.ascii_boards module contains functions for producing and interpreting ASCII diagrams of Go board positions.
Return type: | string |
---|
Returns an ASCII diagram of the position on the Board board.
The returned string does not end with a newline.
>>> b = boards.Board(9)
>>> b.play(2, 5, 'b')
>>> b.play(3, 6, 'w')
>>> print ascii_boards.render_board(b)
9 . . . . . . . . .
8 . . . . . . . . .
7 . . . . . . . . .
6 . . . . . . . . .
5 . . . . . . . . .
4 . . . . . . o . .
3 . . . . . # . . .
2 . . . . . . . . .
1 . . . . . . . . .
A B C D E F G H J
See also the show_sgf.py example script.
Return type: | Board |
---|
Returns the position given in an ASCII diagram.
diagram must be a string in the format returned by render_board(), representing a position with the specified size.
Raises ValueError if it can’t interpret the diagram.
If the optional board parameter is provided, it must be an empty Board of the right size; the same object will be returned (this option is provided so you can use a different Board class).