restructure and add ipi texs

This commit is contained in:
2019-11-06 18:24:04 +01:00
parent e21da561fc
commit 8fd8d2a485
155 changed files with 129 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
// Konstruiere die TM mit Programm und Band
TM::TM (Programm& p, Band& b) : prog(p), band(b)
{
q=p.Anfangszustand();
}
// einen Schritt machen
void TM::Schritt ()
{
// lese Bandsymbol
char s = band.lese();
// schreibe Band
if (prog.Richtung(q,s)==Programm::links)
band.schreibe_links(prog.Ausgabe(q,s));
else
band.schreibe_rechts(prog.Ausgabe(q,s));
// bestimme Folgezustand
q = prog.Folgezustand(q,s);
}
// Ist Endzustand erreicht?
bool TM::Endzustand ()
{
if (q==prog.Endzustand()) return true; else return false;
}