changed Method toString to printBand and show "lesekopf" with different Color.
Delete Main.java
This commit is contained in:
parent
5979e2805b
commit
2b5d791aee
|
@ -1,6 +0,0 @@
|
||||||
public class Main {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
17
src/TM.java
17
src/TM.java
|
@ -35,7 +35,7 @@ public class TM {
|
||||||
if(!onlyResult){
|
if(!onlyResult){
|
||||||
System.out.println("Step: "+numberOfSteps);
|
System.out.println("Step: "+numberOfSteps);
|
||||||
System.out.println("Aktueller zustand: Q" + aktuellerZustand);
|
System.out.println("Aktueller zustand: Q" + aktuellerZustand);
|
||||||
System.out.println(this);
|
printBand();
|
||||||
}
|
}
|
||||||
} catch (TmException e) {
|
} catch (TmException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -45,7 +45,7 @@ public class TM {
|
||||||
System.out.println("Finished:");
|
System.out.println("Finished:");
|
||||||
System.out.println("Zustand: Q" + aktuellerZustand);
|
System.out.println("Zustand: Q" + aktuellerZustand);
|
||||||
System.out.println("Step: "+numberOfSteps);
|
System.out.println("Step: "+numberOfSteps);
|
||||||
System.out.println(this);
|
printBand();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void calcOneStep() throws TmException {
|
private void calcOneStep() throws TmException {
|
||||||
|
@ -77,12 +77,15 @@ public class TM {
|
||||||
aktuellerZustand = str[2].length();
|
aktuellerZustand = str[2].length();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public void printBand() {
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
for(int i = 0; i < band.size(); i++) {
|
||||||
for (Character c : band) {
|
if(i == leseKopf){
|
||||||
stringBuilder.append(c);
|
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() {
|
private boolean checkWin() {
|
||||||
|
|
Loading…
Reference in New Issue