diff --git a/TuringMachine/.idea/misc.xml b/TuringMachine/.idea/misc.xml
new file mode 100644
index 0000000..e0844bc
--- /dev/null
+++ b/TuringMachine/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TuringMachine/.idea/modules.xml b/TuringMachine/.idea/modules.xml
new file mode 100644
index 0000000..fc4bff6
--- /dev/null
+++ b/TuringMachine/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TuringMachine/.idea/vcs.xml b/TuringMachine/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/TuringMachine/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TuringMachine/.idea/workspace.xml b/TuringMachine/.idea/workspace.xml
new file mode 100644
index 0000000..a6fd217
--- /dev/null
+++ b/TuringMachine/.idea/workspace.xml
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1602265039990
+
+
+ 1602265039990
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TuringMachine/README.md b/TuringMachine/README.md
new file mode 100644
index 0000000..439175b
--- /dev/null
+++ b/TuringMachine/README.md
@@ -0,0 +1,17 @@
+# TuringMachine
+
+This is a program developed in IntelliJ idea, its purpose is to simulate the functionality of a Turing Machine.
+
+This specific machine changes every pair of "00" to "11" and vice versa, this using a given graph (Found in src/images)
+
+I hope this is useful for you!
+
+If you are gonna run this in the same IDE, and you get an error, you may do this:
+* Go to "Run"
+* Go to "Edit configurations"
+* In "VM options" add the following line:
+ * --add-modules javafx.controls,javafx.fxml --module-path "YOUR_PATH_TO_JAVAFX_LIB_FOLDER"
+
+Thanks for testing this out!
+
+Best regards, RockLee444.
\ No newline at end of file
diff --git a/TuringMachine/Turing.iml b/TuringMachine/Turing.iml
new file mode 100644
index 0000000..eff3fb3
--- /dev/null
+++ b/TuringMachine/Turing.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TuringMachine/src/Main.java b/TuringMachine/src/Main.java
new file mode 100644
index 0000000..c220753
--- /dev/null
+++ b/TuringMachine/src/Main.java
@@ -0,0 +1,20 @@
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Scene;
+import javafx.scene.layout.AnchorPane;
+import javafx.stage.Stage;
+
+public class Main extends Application {
+ public static void main(String[] args) {
+ Main.launch();
+ }
+
+ @Override
+ public void start(Stage primaryStage) throws Exception {
+ AnchorPane root;
+ root = (AnchorPane) FXMLLoader.load(Main.class.getResource("/views/MainFXML.fxml"));
+ Scene scene = new Scene(root);
+ primaryStage.setScene(scene);
+ primaryStage.show();
+ }
+}
diff --git a/TuringMachine/src/controllers/MainController.java b/TuringMachine/src/controllers/MainController.java
new file mode 100644
index 0000000..e42f73c
--- /dev/null
+++ b/TuringMachine/src/controllers/MainController.java
@@ -0,0 +1,356 @@
+package controllers;
+
+import javafx.animation.FadeTransition;
+import javafx.animation.FillTransition;
+import javafx.animation.SequentialTransition;
+import javafx.animation.TranslateTransition;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
+import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
+import javafx.scene.control.Alert;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.control.TextField;
+import javafx.scene.input.Clipboard;
+import javafx.scene.input.ClipboardContent;
+import javafx.scene.input.DataFormat;
+import javafx.scene.layout.AnchorPane;
+import javafx.scene.layout.StackPane;
+import javafx.scene.paint.Color;
+import javafx.scene.shape.Polygon;
+import javafx.scene.shape.Rectangle;
+import javafx.scene.shape.StrokeType;
+import javafx.scene.text.Font;
+import javafx.scene.text.Text;
+import javafx.stage.StageStyle;
+import javafx.util.Duration;
+
+import javax.swing.*;
+import java.lang.reflect.Array;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.ResourceBundle;
+/*
+ Author: @RockLee444
+ */
+public class MainController implements Initializable {
+ @FXML
+ private AnchorPane anchorPane;
+ @FXML
+ private TextField inputField;
+ @FXML
+ private Button startButton;
+ @FXML
+ private Button resetButton;
+
+ private Polygon head;
+ private ArrayList stackPaneList;
+ private ArrayList animationValue;
+ private ArrayList animationOrder;
+ private String message;
+
+
+ @Override
+ public void initialize(URL url, ResourceBundle resourceBundle) {
+ stackPaneList = new ArrayList<>();
+ animationOrder = new ArrayList<>();
+ animationValue = new ArrayList<>();
+ message = "";
+ startButton.setDisable(false);
+ resetButton.setDisable(true);
+ }
+
+ @FXML
+ public void verifyInput(ActionEvent event){
+ startButton.setDisable(true);
+ resetButton.setDisable(false);
+ String inputText = inputField.getText() + "B";
+ String output = "";
+ String[] inputArray = inputText.split("");
+ String[] outputArray = inputArray.clone();
+ int counter = 0, animationCounter = 0, currentState = 0, finalState = 5, hasSpace = 0;
+ boolean finished = false;
+ animationOrder.add(0);
+ while(!finished) {
+ String data = "";
+ if (counter < outputArray.length) {
+ animationCounter = counter;
+ data = outputArray[counter];
+ }
+ if (!data.equals(" ")) {
+ switch (currentState) {
+ case 0:
+ if (data.equals("0")) {
+ currentState = 1;
+ outputArray[counter] = "" + 0;
+ counter++;
+ } else if (data.equals("1")) {
+ currentState = 4;
+ outputArray[counter] = "" + 1;
+ counter++;
+ } else if (data.equals("B")) {
+ currentState = 5;
+ outputArray[counter] = "B";
+ counter++;
+ } else {
+ currentState = -1;
+ }
+ break;
+
+ case 1:
+ if (data.equals("0")) {
+ currentState = 2;
+ outputArray[counter] = "" + 1;
+ counter--;
+ if(hasSpace>0){
+ for(int i=0;i 0){
+ for(int i=0;i= 0) {
+ if (!finished) {
+ animationOrder.add(animationCounter);
+ animationValue.add(outputArray[animationCounter]);
+ }
+ }
+ hasSpace = 0;
+ } else {
+ counter++;
+ hasSpace++;
+ }
+ }
+
+ for(int i=0;i=0){
+ String inputTextNoEmpty = inputText.split("B")[0];
+ String outputNoEmpty = output.split("B")[0];
+ message = "The input '" + inputTextNoEmpty + "' is correct.\n" +
+ "The output is: '" + outputNoEmpty + "'\n" +
+ "The result has been copied to the clipboard.";
+ generateVisualNodes(inputText);
+ moveHead(animationOrder,animationValue);
+ copyToClipboard(outputNoEmpty);
+ } else {
+ String inputTextNoEmpty = inputText.split("B")[0];
+ message = "The input '" + inputTextNoEmpty + "' contains non-valid symbols.";
+ showAlert(1,"ERROR", message);
+ restartProgram();
+ }
+ }
+
+ public void generateVisualNodes(String input){
+ int layoutX = -29, layoutY = 254, counter = 0;
+ double polygonPointLeft[] = {1, 310};
+ double polygonPointRight[] = {25, 310};
+ double polygonPointTop[] = {12.5, 290};
+ StackPane stackPane;
+ Text text;
+ Rectangle rectangle;
+ Rectangle baseRectangle = null;
+ head = new Polygon( polygonPointLeft[0],polygonPointLeft[1],
+ polygonPointRight[0],polygonPointRight[1],
+ polygonPointTop[0],polygonPointTop[1]);
+ head.setFill(Color.BLACK);
+ head.setStroke(Color.WHITE);
+ head.setStrokeWidth(2);
+ head.setStrokeType(StrokeType.INSIDE);
+ anchorPane.getChildren().add(head);
+
+ String inputArray[] = input.split("");
+
+ for(int i=0;i order, ArrayList valuesArray){
+ SequentialTransition sequentialTransition = new SequentialTransition();
+ int previousPosition,newPosition, counter= 0;
+ double fromX,toX;
+ for(int i=0;i() {
+ @Override
+ public void handle(ActionEvent event) {
+ Text text =(Text) stackPaneList.get(finalNewPosition).getChildren().get(1);
+ text.setText(valuesArray.get(finalI));
+ }
+ });
+ } else {
+ counter = 1;
+ }
+ sequentialTransition.getChildren().addAll(translateTransition,fillTransition,fillTransition2);
+
+ }
+ }
+ sequentialTransition.setOnFinished(new EventHandler() {
+ @Override
+ public void handle(ActionEvent event) {
+ showAlert(0,"HECHO", message);
+ }
+ });
+ sequentialTransition.play();
+ }
+
+ private void showAlert(int alertType,String title, String contentText){
+ Alert alert = null;
+ if(alertType == 0) {
+ alert = new Alert(Alert.AlertType.CONFIRMATION);
+ } else {
+ alert = new Alert(Alert.AlertType.ERROR);
+ }
+ alert.setTitle(title);
+ alert.setContentText(contentText);
+ alert.initStyle(StageStyle.UTILITY);
+ alert.setHeaderText(null);
+ alert.show();
+
+ }
+
+ @FXML
+ public void restartProgram(){
+ anchorPane.getChildren().removeAll(stackPaneList);
+ anchorPane.getChildren().remove(head);
+ inputField.setText("");
+ stackPaneList = new ArrayList<>();
+ animationOrder = new ArrayList<>();
+ animationValue = new ArrayList<>();
+ startButton.setDisable(false);
+ resetButton.setDisable(true);
+ }
+
+ public void copyToClipboard(String result){
+ Clipboard clipboard = Clipboard.getSystemClipboard();
+ ClipboardContent clipboardContent = new ClipboardContent();
+ clipboardContent.put(DataFormat.PLAIN_TEXT, result);;
+ clipboard.setContent(clipboardContent);
+ }
+
+}
diff --git a/TuringMachine/src/images/graph.png b/TuringMachine/src/images/graph.png
new file mode 100644
index 0000000..60af680
Binary files /dev/null and b/TuringMachine/src/images/graph.png differ
diff --git a/TuringMachine/src/views/MainFXML.fxml b/TuringMachine/src/views/MainFXML.fxml
new file mode 100644
index 0000000..0a8fe88
--- /dev/null
+++ b/TuringMachine/src/views/MainFXML.fxml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+