本文整理汇总了C++中Tape::PrintLine方法的典型用法代码示例。如果您正苦于以下问题:C++ Tape::PrintLine方法的具体用法?C++ Tape::PrintLine怎么用?C++ Tape::PrintLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tape
的用法示例。
在下文中一共展示了Tape::PrintLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
void Run(Tape &tape, bool print_each_step = false)
{
if (print_each_step)
tape.PrintLine();
m_state = 0;
while (!m_state_final[m_state])
{
Rule23::iterator i = m_rules.find(m_state);
if (i == m_rules.end())
{
std::cerr << 'S' << m_state << " undefined.\n";
break;
}
char symbol_read = tape.Read();
Rule13 &rule13 = i->second;
Rule13::iterator j = rule13.find(symbol_read);
if (j == rule13.end())
{
std::cerr << "No rule for S" << m_state << " and '" << symbol_read << "'.\n";
break;
}
Rule03 &rule03 = j->second;
m_state = std::get<0>(rule03);
char symbol_write = std::get<1>(rule03);
tape.Write(symbol_write);
char direction = std::get<2>(rule03);
if (direction == 'L')
tape.MoveLeft();
else if (direction == 'R')
tape.MoveRight();
if (print_each_step)
tape.PrintLine();
}
}