changed Method toString to printBand and show "lesekopf" with different Color.
Delete Main.java
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
+10
-7
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user