Moditrennung hinzugefügt.

This commit is contained in:
leobr 2022-05-08 22:32:51 +02:00
parent 08db5c1342
commit 5979e2805b
2 changed files with 16 additions and 9 deletions

View File

@ -27,15 +27,16 @@ public class TM {
}
public void start() {
public void start(boolean onlyResult) {
while (!checkWin() ) {
try {
calcOneStep();
appendToBand();
if(!onlyResult){
System.out.println("Step: "+numberOfSteps);
System.out.println("Aktueller zustand: Q" + aktuellerZustand);
System.out.println(this);
}
} catch (TmException e) {
e.printStackTrace();
break;

View File

@ -5,18 +5,24 @@ public class TestClass {
TM turing;
/**
* Test von Turingmaschine Multiplikation 2x3 nur mit Ausgabe vom Resultat
*/
@Test
void check() {
turing = new TM("101010001000100110100100000000000010001001100010010000100100110001010001010011000010001000001001011000010010000010010110000101000010100110000010000100000100001001100000100100000010010011000001010000010000100110000001000100000001010110000001010000001010011000000010010000000010010110000000101000000010101100000000100001000000001000010110000000010010000000001001001100000000101000001000010011000000000100001000000000101001100000000010010000000000100101100000000001001000000000001001011000000000010100000000001010110000000000010001010001001100000000000101000000000001010110000000000001001001000100110000000000001010000000000001000100",
"001000");
turing.start();
turing.start(true);
}
/**
* Test von Turingmaschine Multiplikation 3x4 mit Step by Step Ausgabe.
*/
@Test
void check2() {
turing = new TM("101010001000100110100100000000000010001001100010010000100100110001010001010011000010001000001001011000010010000010010110000101000010100110000010000100000100001001100000100100000010010011000001010000010000100110000001000100000001010110000001010000001010011000000010010000000010010110000000101000000010101100000000100001000000001000010110000000010010000000001001001100000000101000001000010011000000000100001000000000101001100000000010010000000000100101100000000001001000000000001001011000000000010100000000001010110000000000010001010001001100000000000101000000000001010110000000000001001001000100110000000000001010000000000001000100",
"0001000");
turing.start();
turing.start(false);
}
}