PyTuring A general Turing machine simulator Readme ====== Introduction ------------ This program is a simulator of a general Turing machine, in that its behavior (the rules) is totally unrestricted. It accepts CSV file as representation of the machine's behavior (the transition table), and a plain text file for input tape. Features -------- From version 1.01 onward, the features are: * Capability to read transition table from CSV (comma-separated values) format file (Microsoft Excel export-compatible), and input string for feeded tape in another file. * Supports finite-length and (virtually-)infinite-length tape ("virtually", as usual, means its dependence to a system's capability). * Easy to follow visual cues, complete with display of relevant time-dependent variables. * Other machine customization options, such as defining starting state and initial tape position. * More than anything else: the source is available to you, accompanied with relevant sidenotes to let you modify it right away. Table format ------------ The machine uses a simple transition table, and is converted into CSV format in a quite straightforward manner. For a Turing machine M, and input alphabet I = {0,1}, a sample transition table for M could be +-------+-------+-------+ | | 0 | 1 | +-------+-------+-------+ | 0 | 1L1 | 1R0 | | 1 | 0R2 | 1L1 | +-------+-------+-------+ *) With this behavior, M adds the number of consecutive 1's in the input string. The table in a CSV form: ,0,1 0,1L1,1R0 1,0R2,1L1 The first comma before 0 is intentional, because if we see the commas in the CSV table as column delimiter (which is its only purpose) the table will be laid out similarly with the previous, easier to read, form. In fact, PyTuring will raise an error if the first column is not empty; because the cell is insignificant for translation from the table into proper machine behavior, non-empty first cell is assumed to be a typing error (you forget to insert the comma, or the like). Further Note ------------ If you really want to spend your time writing such a CSV table by hand, please read the source and documentation of cvstable.py for potential quirks, caused especially by its use of regex pattern. In a relatively few cases, certain typing mistake will make a machine instruction ignored. The same use of regex pattern could make your table easier to read and understand, though. Installation ------------ Unzip to a particular directory, and run it. It's that simple if your system has all the required components installed, which are: - Python 2.3 or newer. It hasn't been tested on any older Python interpreter, but 2.3 is a safe bet because of several module and language features used. - Tkinter 1.18 or newer (it's included in standard distributions, but just in case it's not...). This is required only if you want to run the GUI version, which, as of version 1.0, is still being debugged. Copyright Notice ---------------- Copyright Adhi Hargo, 2006. See file COPYRIGHT for full detail. Code Improvement ---------------- Code improvements and bugfixes for PyTuring can be sent to me for the benefit of every user; useful ones will be included in future versions, with proper credit to the contributor. These, or any remarks, opinion, or suggestion can be sent to my email address: cadmus_sw AT yahoo DOT com And it is always awaited and welcomed. I intend to make this part of a greater community effort, especially for Indonesians, to make a suite of educational programs concerning many aspects of Theory of Computation and Computer Science in general, and I want it to have as solid a framework as possible before it is to be released as such. But until the day comes, the least I can possibly work out is to make this a fun toy to play with. So I wish you a pleasant experience with it. Latest version of this program can always be found at: adhihargo.net/kode/pyturing/ end 27/03/2006 11:43:15 ================================================================================