Checks if the candidate point actually exists in the grid.
pt – The point to check if it is in bounds.
dim – Dimensions (row, column) of the grid.
in_bounds()