ascii property
String
get
ascii
Returns a String representation of the current position complete with ascii art
Implementation
String get ascii {
var s = ' +------------------------+\n';
for (var i = SQUARES_A8; i <= SQUARES_H1; i++) {
/* display the rank */
if (file(i) == 0) {
s += ' ' + '87654321'[rank(i)] + ' |';
}
/* empty piece */
if (board[i] == null) {
s += ' . ';
} else {
var type = board[i]!.type;
var color = board[i]!.color;
var symbol = (color == WHITE) ? type.toUpperCase() : type.toLowerCase();
s += ' ' + symbol + ' ';
}
if (((i + 1) & 0x88) != 0) {
s += '|\n';
i += 8;
}
}
s += ' +------------------------+\n';
s += ' a b c d e f g h\n';
return s;
}