containsBlock method

bool containsBlock(
  1. Block block
)

Return whether the matrix contains a block in its bounds.

Implementation

bool containsBlock(Block block) {
  return block.y >= 0 &&
      block.y < matrix.length &&
      block.x >= 0 &&
      block.x < matrix[block.y].length;
}