MCPcopy Create free account
hub / github.com/cutechess/cutechess / parseLine

Method parseLine

projects/lib/src/uciengine.cpp:588–745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

586}
587
588void UciEngine::parseLine(const QString& line)
589{
590 auto input = tokenize(line);
591 auto command = input.first;
592 auto args = input.second;
593 if (command.isEmpty())
594 return;
595
596 if (command == QLatin1String("info"))
597 {
598 if (m_ignoreThinking)
599 return;
600
601 MoveEvaluation eval = parseInfo(line);
602 if (eval.isEmpty())
603 return;
604
605 if (!m_ponderMove.isNull())
606 eval.setPonderMove(m_ponderMoveSan);
607 if (m_movesPondered)
608 eval.setPonderhitRate((m_ponderHits * 1000) / m_movesPondered);
609
610 // Only the primary PV can be considered the current eval
611 if (eval.pvNumber() <= 1)
612 {
613 m_eval.merge(eval);
614 if (eval.depth() && eval.depth() != m_currentEval.depth())
615 m_currentEval.clear();
616 m_currentEval.merge(eval);
617
618 emit thinking(m_currentEval);
619 }
620 else
621 emit thinking(eval);
622 }
623 else if (command == QLatin1String("bestmove"))
624 {
625 bool wasPondering = isPondering();
626 m_ponderState = NotPondering;
627 if (m_ignoreThinking)
628 {
629 m_ignoreThinking = false;
630 if (!m_bmBuffer.isEmpty())
631 {
632 const auto buf = m_bmBuffer;
633 for (const auto& l : buf)
634 write(l, Unbuffered);
635 m_bmBuffer.clear();
636 }
637 else
638 pong();
639 return;
640 }
641 else if (wasPondering)
642 {
643 qWarning("Premature bestmove while pondering from %s",
644 qUtf8Printable(name()));
645 m_ponderMove = Chess::Move();

Callers

nothing calls this directly

Calls 15

nameFunction · 0.85
variantFromUciFunction · 0.85
setPonderhitRateMethod · 0.80
pvNumberMethod · 0.80
mergeMethod · 0.80
depthMethod · 0.80
moveFromStringMethod · 0.80
MoveClass · 0.50
isEmptyMethod · 0.45
isNullMethod · 0.45
setPonderMoveMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected