if(literal instanceof GdlSentence) {
GdlSentence sentence = (GdlSentence) literal;
if(SentenceModelUtils.inSentenceFormGroup(sentence, formsControlledByFlow))
relevantLiterals.add(literal);
} else if(literal instanceof GdlNot) {
GdlNot not = (GdlNot) literal;
GdlSentence innerSentence = (GdlSentence) not.getBody();
if(SentenceModelUtils.inSentenceFormGroup(innerSentence, formsControlledByFlow))
relevantLiterals.add(literal);
}
}
//If none are related to the game flow, then that's it. It can
//happen on any turn.
//if(relevantLiterals.isEmpty())
//return getCompleteTurnSet();
Set<Integer> turnsPossible = new HashSet<Integer>(getCompleteTurnSet());
//For each of the relevant literals, we need to see if there are assignments
//such that
for(GdlLiteral literal : relevantLiterals) {
List<Integer> turns = new ArrayList<Integer>();
if(literal instanceof GdlSentence) {
for(int t = 0; t < getNumTurns(); t++) {
if(sentencesTrueByTurn.get(t).contains(literal))
turns.add(t);
else for(GdlSentence s : sentencesTrueByTurn.get(t)) {
//Could be true if there's an assignment
if(null != GdlUtils.getAssignmentMakingLeftIntoRight((GdlSentence)literal, s)) {
turns.add(t);
break;
}
}
}
} else if(literal instanceof GdlNot) {
GdlNot not = (GdlNot) literal;
GdlSentence internal = (GdlSentence) not.getBody();
for(int t = 0; t < getNumTurns(); t++) {
if(!sentencesTrueByTurn.get(t).contains(internal))
turns.add(t);
else for(GdlSentence s : sentencesTrueByTurn.get(t)) {
if(null != GdlUtils.getAssignmentMakingLeftIntoRight(internal, s)) {