Added effect ID as a placeholder (for conditional effects) for consistency with unified output format.

This commit is contained in:
Patrick Lühne 2016-08-13 03:17:48 +02:00
parent 1f35bda3d2
commit 97d33da686

View File

@ -204,12 +204,16 @@ void TranslatorASP::translateActions() const
{ {
// TODO: rename // TODO: rename
const auto translateLiteral = const auto translateLiteral =
[&](const auto &ruleHead, const auto &literal) [&](const auto &ruleHead, const auto &literal, bool enumerateEffects = false)
{ {
m_outputStream << std::endl << utils::Keyword(ruleHead) << "("; m_outputStream << std::endl << utils::Keyword(ruleHead) << "(";
printActionName(*action); printActionName(*action);
// TODO: remove quirk
if (enumerateEffects)
m_outputStream << ", " << utils::Keyword("effect") << "(" << utils::Number("0") << ")";
m_outputStream << ", "; m_outputStream << ", ";
this->translateLiteral(literal); this->translateLiteral(literal);
@ -266,7 +270,7 @@ void TranslatorASP::translateActions() const
if (effect.expressionType() == Expression::Type::Predicate if (effect.expressionType() == Expression::Type::Predicate
|| effect.expressionType() == Expression::Type::Not) || effect.expressionType() == Expression::Type::Not)
{ {
translateLiteral("postcondition", effect); translateLiteral("postcondition", effect, true);
} }
// Assuming a conjunction // Assuming a conjunction
else else
@ -279,7 +283,7 @@ void TranslatorASP::translateActions() const
std::for_each(andExpression.arguments().cbegin(), andExpression.arguments().cend(), std::for_each(andExpression.arguments().cbegin(), andExpression.arguments().cend(),
[&](const auto *argument) [&](const auto *argument)
{ {
translateLiteral("postcondition", *argument); translateLiteral("postcondition", *argument, true);
}); });
} }
} }