Let's define a simple 2D language, which we'll give the incredibly original name befinge. Befinge has 5 instructions:
<>^v, as in most 2D esolangs, redirect the instruction pointer in their respective directions.
.is a no-op.
The instruction pointer starts out at the top-left corner going right. If the instruction pointer gets to an edge, the program halts. Every Befinge program will obviously either halt or go into an infinite loop which does nothing. Here are two examples:
>....v ..v..< ..>v.. ^..<..
The halting problem is not solvable for a Turing-complete language, but it is for this one. Your task is to write a program (or function) that takes as input a string representing the befinge program and returns a truthy or falsey value depending on whether it halts or not.
- You can assume that the input will consist only of these characters and will be padded with spaces to form a rectangle.
- You can use any set of five characters for the instructions (e.g.
....v.... ....>...v .^..<.... .......v< .......v. ....^..<.
v<>v>v^ >v^>^>v <>>^v<v v^<>v^<
>v< v<. >v. v<. >.^
This is code-golf, so the shortest program (in bytes) wins.