Universal Turing machine: Difference between revisions

Content added Content deleted
Line 578: Line 578:
{{works with|Java Virtual Machine|6.0}}
{{works with|Java Virtual Machine|6.0}}


This is an implementation of the universal Turing machine in plain Java using standard libraries only. As generics are used, Java 6 is required. The examples (incrementer and busy beaver) are implemented directly in the main method and executed subsequentially. During execution the complete tape and the current state / tape symbol pair are printed out in every step. The state names and tape symbols may contain several characters, so arbitrary strings such as "q1", "q2", ... can be valid state names or tape symbols. This is not a standard implementation, but I coded this on my own, so there is no guarantee of correctness.
This is an implementation of the universal Turing machine in plain Java using standard libraries only. As generics are used, Java 6 is required. The examples (incrementer and busy beaver) are implemented directly in the main method and executed subsequentially. During execution the complete tape and the current state / tape symbol pair are printed out in every step. The state names and tape symbols may contain several characters, so arbitrary strings such as "q1", "q2", ... can be valid state names or tape symbols. The machine is deterministic as the transitions are stored in a HashMap which uses state / tape symbol pairs as keys. This is not a standard implementation, but I coded this on my own, so there is no guarantee of correctness.


<lang Java>
<lang Java>