18 lines
577 B
C++
18 lines
577 B
C++
|
#include <iostream>
|
||
|
|
||
|
#include "../turing.cpp"
|
||
|
|
||
|
/**
|
||
|
* @brief Prints debug-like information about provided machine
|
||
|
*/
|
||
|
template <typename S, typename V>
|
||
|
void print(Turing::Machine<S, V>* machine) {
|
||
|
machine->ensure();
|
||
|
std::cout << "rc:" << machine->runCount << ", st:" << machine->getState() << '\n';
|
||
|
for (int i = machine->getMemoryStart(); i < machine->getMemoryEnd(); i++)
|
||
|
std::cout << (machine->at(i));
|
||
|
std::cout << '\n';
|
||
|
for (int i = machine->getMemoryStart(); i < machine->getPosition(); i++)
|
||
|
std::cout << ' ';
|
||
|
std::cout << "^\n\n";
|
||
|
}
|