forked from amirbawab/Turing-Machine-simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddition.java
More file actions
34 lines (26 loc) · 832 Bytes
/
Copy pathAddition.java
File metadata and controls
34 lines (26 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.io.FileNotFoundException;
import turingMachine.TuringMachine;
/**
* Turing Machine
* Coded by Amir El Bawab
* Date: 3 January 2015
* License: MIT License ~ Please read License.txt for more information about the usage of this software
* */
public class Addition {
public static void main(String[] args) {
try {
// Import addition machine
TuringMachine addition = TuringMachine.inParser("addition");
// Print addition machine
System.out.println("Machine content:");
System.out.println(addition);
// Process input
addition.process("1011");
// Print the tape content after the process
System.out.println("Tape content after processing '1011':");
System.out.println(addition.getTapeSnapshot());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}