To solve the Halting Problem you are given a description of a program, and must determine whether or not it will ever finish. You can never do this for all programs. Yet for programs like (in brainf***):
It obviously will halt, and for programs like:
It obviously will not. Your challenge is to "solve" the halting problem for as many programs as possible. These programs will not use
,, and will not have input or output. You will be given a description of the program and must output either "Halts", "Does not halt", or "Unknown". When your program outputs "Halts" or "Does not halt", you have solved the input program. Here are some requirements.
- It must solve at least an infinite amount of programs.
- For every program it solves, its solution must be correct.
- You may only output 1 of the 3 above choices.
- You may assume that the running computer has infinite time and memory, so XKCD 1266 would not work (the tape is unlimited).
- No external resources.
- You may not use a programming language that can actually solve the halting problem.
You may have a non-code-golfed side program that takes a string that is a program, and generates some sort of abstract syntax tree of it if you like. Note, that isn't really scoring per se, but how to determine if one program beats another.
- If program A solves an infinite number of programs that B doesn't, but B only solves finite or no programs that A solves, A automatically wins.
- Otherwise, the program with the fewest characters wins. Do not count white space or comments, so do not obfuscate your code.
Tip: Timers won't work. You see, for any time T and given machine, there is an N, such that all programs longer than that have to take more than T time. This means that a timer can only achieve the solution of a finite number of programs, and, as you can see above, solving a finite number of programs doesn't help.