Moditrennung hinzugefügt.
This commit is contained in:
parent
08db5c1342
commit
5979e2805b
|
@ -27,15 +27,16 @@ public class TM {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start(boolean onlyResult) {
|
||||||
while (!checkWin() ) {
|
while (!checkWin() ) {
|
||||||
try {
|
try {
|
||||||
calcOneStep();
|
calcOneStep();
|
||||||
appendToBand();
|
appendToBand();
|
||||||
|
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);
|
System.out.println(this);
|
||||||
|
}
|
||||||
} catch (TmException e) {
|
} catch (TmException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -5,18 +5,24 @@ public class TestClass {
|
||||||
|
|
||||||
TM turing;
|
TM turing;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test von Turingmaschine Multiplikation 2x3 nur mit Ausgabe vom Resultat
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
void check() {
|
void check() {
|
||||||
turing = new TM("101010001000100110100100000000000010001001100010010000100100110001010001010011000010001000001001011000010010000010010110000101000010100110000010000100000100001001100000100100000010010011000001010000010000100110000001000100000001010110000001010000001010011000000010010000000010010110000000101000000010101100000000100001000000001000010110000000010010000000001001001100000000101000001000010011000000000100001000000000101001100000000010010000000000100101100000000001001000000000001001011000000000010100000000001010110000000000010001010001001100000000000101000000000001010110000000000001001001000100110000000000001010000000000001000100",
|
turing = new TM("101010001000100110100100000000000010001001100010010000100100110001010001010011000010001000001001011000010010000010010110000101000010100110000010000100000100001001100000100100000010010011000001010000010000100110000001000100000001010110000001010000001010011000000010010000000010010110000000101000000010101100000000100001000000001000010110000000010010000000001001001100000000101000001000010011000000000100001000000000101001100000000010010000000000100101100000000001001000000000001001011000000000010100000000001010110000000000010001010001001100000000000101000000000001010110000000000001001001000100110000000000001010000000000001000100",
|
||||||
"001000");
|
"001000");
|
||||||
turing.start();
|
turing.start(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test von Turingmaschine Multiplikation 3x4 mit Step by Step Ausgabe.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
void check2() {
|
void check2() {
|
||||||
turing = new TM("101010001000100110100100000000000010001001100010010000100100110001010001010011000010001000001001011000010010000010010110000101000010100110000010000100000100001001100000100100000010010011000001010000010000100110000001000100000001010110000001010000001010011000000010010000000010010110000000101000000010101100000000100001000000001000010110000000010010000000001001001100000000101000001000010011000000000100001000000000101001100000000010010000000000100101100000000001001000000000001001011000000000010100000000001010110000000000010001010001001100000000000101000000000001010110000000000001001001000100110000000000001010000000000001000100",
|
turing = new TM("101010001000100110100100000000000010001001100010010000100100110001010001010011000010001000001001011000010010000010010110000101000010100110000010000100000100001001100000100100000010010011000001010000010000100110000001000100000001010110000001010000001010011000000010010000000010010110000000101000000010101100000000100001000000001000010110000000010010000000001001001100000000101000001000010011000000000100001000000000101001100000000010010000000000100101100000000001001000000000001001011000000000010100000000001010110000000000010001010001001100000000000101000000000001010110000000000001001001000100110000000000001010000000000001000100",
|
||||||
"0001000");
|
"0001000");
|
||||||
turing.start();
|
turing.start(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue