def is_offboard(position, board):
    """ Returns true if position lies off board """
    n_rows, n_cols = board.shape
    return (
        position[0] < 0
        or position[1] < 0
        or position[0] >= n_rows
        or position[1] >= n_cols
    )