Detecting infinite loop in brainfuck program
问题 I have written a simple brainfuck interpreter in MATLAB script language. It is fed random bf programs to execute (as part of a genetic algorithm project). The problem I face is, the program turns out to have an infinite loop in a sizeable number of cases, and hence the GA gets stuck at the point. So, I need a mechanism to detect infinite loops and avoid executing that code in bf. One obvious (trivial) case is when I have [] I can detect this and refuse to run that program. For the non-trivial