diff --git a/src/Main.java b/src/Main.java deleted file mode 100644 index 1ef8157..0000000 --- a/src/Main.java +++ /dev/null @@ -1,6 +0,0 @@ -public class Main { - - public static void main(String[] args) { - - } -} diff --git a/src/TM.java b/src/TM.java index fb70a9e..9026ff0 100644 --- a/src/TM.java +++ b/src/TM.java @@ -35,7 +35,7 @@ public class TM { if(!onlyResult){ System.out.println("Step: "+numberOfSteps); System.out.println("Aktueller zustand: Q" + aktuellerZustand); - System.out.println(this); + printBand(); } } catch (TmException e) { e.printStackTrace(); @@ -45,7 +45,7 @@ public class TM { System.out.println("Finished:"); System.out.println("Zustand: Q" + aktuellerZustand); System.out.println("Step: "+numberOfSteps); - System.out.println(this); + printBand(); } private void calcOneStep() throws TmException { @@ -77,12 +77,15 @@ public class TM { aktuellerZustand = str[2].length(); } - public String toString() { - StringBuilder stringBuilder = new StringBuilder(); - for (Character c : band) { - stringBuilder.append(c); + public void printBand() { + for(int i = 0; i < band.size(); i++) { + if(i == leseKopf){ + System.out.print("\u001B[31m" + band.get(i) + "\u001B[0m"); + } else { + System.out.print(band.get(i)); + } } - return stringBuilder.toString(); + System.out.println(); } private boolean checkWin() {