Detecting infinite loop in brainfuck program

前端 未结 9 1674
无人及你
无人及你 2021-02-04 00:18

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,

9条回答
  •  天命终不由人
    2021-02-04 01:05

    This is not the halting problem, however, it is still not reasonable to try to detect halting even in such a limited machine as a 1000 cell BF machine.

    Consider this program:

    +[->[>]+<[-<]+]
    

    This program will not repeat until it has filled up the entire of memory which for just 1000 cells will take about 10^300 years.

提交回复
热议问题