makina is a cell-based esolang composed of automata which move around a grid. These automata follow paths of instructions that direct their movement. Your task is to, given a makina program using only the below instructions (so a subset of normal makina) as input, output two distinct values depending on whether or not it is a loop. (If program flow comes to an arrow character that it has already visited then the program is a loop.)
Instructions
^>v<
These instructions (arrows) set the direction of the automaton to the direction they point in.I
This instruction halts automata going up or down, but does nothing to ones going left or right.H
This instruction halts automata going left or right, but does nothing to ones going up or down.O
This instruction does nothing to the automaton, acting like a sort of 4-way intersection.
All other characters (including spaces) halt the automaton, as does exiting the bounds of the program. The automaton starts in the top-left corner going right. You may assume programs are padded by spaces to be rectangular. This is code-golf, so shortest answer wins!
Testcases
Truthy
>>>v
v<<<
OOOv
H<<<
v
>>>v
v<I<
H>^
>^
>>>>v
v <<<
Falsey
>>>v
^<<<
>v
^O<
>^
OOOv H<<< v
is truthy and falsy? \$\endgroup\$>>>>v v <<<
(second-to-last [before edit, now it's the last] falsy case) halt? Doesn't it hit a space and then halt? \$\endgroup\$>>>v/v<I</H>^/>^
be falsy? Won't it halt onI
? \$\endgroup\$vv<v<X/>OOOOv/vOOOO</>OOOOv/XO^<^<
. My previous answer failed on it. \$\endgroup\$