@ -21,10 +21,13 @@ def patrol(lab)
loop do
pos, dir = path.last
peek = pos.zip(dir).map {|i,di| i + di }
return path unless lab.has_key?(peek)
raise Loop if seen.include?([peek, dir])
seen << [peek, dir]
case lab.fetch(peek, nil)
case lab.fetch(peek)
when ?., ?^
path << [peek, dir]
when ?#