Use a loop
instead, something like:
def bad_goal_point?(x, y)
@maze[y][x] == GOAL || @maze[y][x] == START || @maze[y][x].to_i >= 75
end
def set_goal
loop do
x = sample_x
y = sample_y
break unless bad_goal_point?(x, y)
end
@maze[y][x] = GOAL
@graphic_maze[y][x] = GOAL
puts "***Goal point initialized.***\n"
end