getCharacter method
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];
}