General Discussion > Other

TinyTuring - A Turing machine on an Arduino

(1/3) > >>

Spyro543:
TinyTuring
What is it?
TinyTuring is a simulated Turing machine running on my Arduino. More details below:
I/O
Input: 4 buttons (Left, Right, OK, Back)
Output: 16 character, 2 line LCD
Memory
States: 10
Tape size: 16 cells
Picture


Main Menu and Functions
Menu Items
Edit Program - starts programming interface

Run Program - runs program in memory

Edit Tape - the tape can be preset with values before the program is started

Clear Tape - sets all tape cells to 0

Clear Program - erases program in memory

Controls
Left/Right: scroll though menu items
OK: Launch selected menu item
Back: N/A

Edit Program
Description
Select state to edit

Choose to edit what the program will do if it scans a 0 or 1

What the program writes to the tape (0 or 1)

What direction the head will move after writing (0=left, 1=right)

The next state to jump to after this one is done (0=halt program)

These values can be edited, of course

Controls
While selecting state
Left/Right: Scroll through states
OK: Edit selected state
Back: Return to main menu
While selecting symbol scanned
Left/Right: Scroll through possible symbols to scan
OK: Edit instructions based on selected symbol
Back: Return to states
While selecting value to edit
Left/Right: Scroll through values to edit
OK: Edit selected value
Back: Return to symbols to scan
While editing value
Left/Right: Decrement/increment selected value
OK: Save value and stop editing
Back: N/A

Run Program
Description
This mode runs the program written in "Edit Program" mode. The head is represented by a karat symbol ^ .

Program Running in Above Example
Description
This program moves the head to the right and writes '1's to the tape continuously.
Code
State 1, Scan 0
Write: 1
Move: 1
Next: 1
Controls
While program is running
Left/Right: N/A
OK: N/A
Back: Halt program
While program is halted
Left/Right: N/A
OK: N/A
Back: Return to main menu

Edit Tape
Description
This mode is used to preset values in the tape before a program is ran

Controls
Left/Right: Move cursor
OK: Flip bit at cursor
Back: Return to main menu

Clear Tape/Clear Program
Description
These modes clear the tape (set to all '0's) and the program in memory


Controls
Left/Right: Move cursor
OK: Select option at cursor
Back: N/A

SpiroH:
 A Nice Tiny Turing Toy (NT3) you've got there.  ;)

Suggestion: You still have plenty of space on the breadboard, why don't you plug in some leds to complement the matrix display of zeros and ones.
Instead of using the karat to represent the head, you could just as well make that led blink.

Good job!

Spyro543:
EDIT: I forgot to respond to you, SpiroH. :P


--- Quote from: SpiroH on May 25, 2015, 02:30:58 pm --- A Nice Tiny Turing Toy (NT3) you've got there.  ;)

--- End quote ---
Thanks ;) I might have to use that name instead.


--- Quote from: SpiroH on May 25, 2015, 02:30:58 pm ---Suggestion: You still have plenty of space on the breadboard, why don't you plug in some leds to complement the matrix display of zeros and ones.
Instead of using the karat to represent the head, you could just as well make that led blink.

--- End quote ---
That does sound kind of neat. I might consider doing that sometime.

New features!
More states - I realized I have a lot more memory to work with than I thought, so there can now be up to 20 states in a program.

Programs can now be stored on the EEPROM - The Arduino has a 1KB EEPROM in it, so why not store programs to it? Up to 4 programs can be stored on the EEPROM at once.

New menu items for saving and loading programs on the EEPROM:


The interface for selecting program slots:

When doing anything with the EEPROM, the program asks if you are sure you want to do stuff, and gives a confirmation message when finished:

Sorunome:
Nice thing! You should totally do some Busy beaver fun with it :P

Spyro543:

--- Quote from: Sorunome on May 25, 2015, 03:20:15 pm ---Nice thing! You should totally do some Busy beaver fun with it :P

--- End quote ---
I did a little bit. ;D Slot 2 currently holds a 3-state busy beaver.

Navigation

[0] Message Index

[#] Next page

Go to full version