Set<GdlSentence> results = prover.askAll(ProverQueryBuilder.getGoalQuery(role), ProverQueryBuilder.getContext(state));
if (results.size() != 1)
{
GamerLogger.logError("StateMachine", "Got goal results of size: " + results.size() + " when expecting size one.");
throw new GoalDefinitionException(state, role);
}
try
{
GdlRelation relation = (GdlRelation) results.iterator().next();
GdlConstant constant = (GdlConstant) relation.get(1);
return Integer.parseInt(constant.toString());
}
catch (Exception e)
{
throw new GoalDefinitionException(state, role);
}
}