Coder Social home page Coder Social logo

gmh5225 / turing-machine-simulator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fcortes/turing-machine-simulator

0.0 1.0 0.0 23 KB

Simple turing machine simulator using the syntax of the online simulator at turingmachinesimulator.com

License: Other

C++ 99.71% Makefile 0.29%

turing-machine-simulator's Introduction

Turing Machine Simulator

This is a simple attempt to replicate the (awesome) work done in the online Turing machine simulator at turingmachinesimulator.com in C++ so it is faster to test big machines. I don't claim it ot be bug-free, feature complete, well written nor the fastest possible implementation but it serves its purpose decently well.

Building

make

Usage

In the examples directory there are some nice algorithms implemented for the online simulator that can be used to to test this simulator (some were copied verbatim from the online simulator examples, others were written by me). The basic syntax is as follows

./turing <tm_code> <input_string>

If you want to simulate the machine without input you can use _ as the second argument. The underscore character works as the TM blank symbol so it is equivalent.

Flags

The simulator has several flags to get more information out of the simulation, the following summary comes up when the simulator is ran without arguments.

	Usage
	turing <tm_file> <input_word>

	--show_machine [false]:
			Show a summary of the parsed TM
	--show_steps [false]:
			Show each step of the main tape of the TM excecution
	--run [true]:
			Run the TM
	--output [true]:
			Output the final content of the TM tapes
	--max_steps [10000000]:
			Maximum number of steps
	--limit [true]:
			Limit number of steps

Examples

Try running the following commands to see the simulator working

# 5-state busy beaver machine. It will run for a while
./turing examples/bb5.tm _ --nolimit --nooutput

# Decimal to binary converter. This will only show the machine
./turing examples/dec2bin.tm --show_machine --norun

# Duplicate binary string with single tape
./turing examples/dup_bin_string.tm 101 --show_steps

# Sort a list of binary numbers
./turing examples/list_sort.tm 0101#0011#0110#0111#0011#1000

turing-machine-simulator's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.