getCharacter method

String getCharacter(
  1. int x,
  2. int y
)

Gets the character at (x, y). Returns a space if coordinates are out of bounds.

Implementation

String getCharacter(int x, int y) {
  if (x < 0 || x >= width || y < 0 || y >= height) return ' ';
  return characters[y * width + x];
}