boundsCheck method
Ensures that the given position x
, y
is within the bounds of this
Terminal
Implementation
void boundsCheck(int x, int y) {
if (x < 0 || x >= width) throw RangeError.range(x, 0, width - 1);
if (y < 0 || y >= height) throw RangeError.range(y, 0, height - 1);
}