/// <summary> /// Checks wether the given WorldModel complies with this goals conditions. /// </summary> /// <returns>"true" if goal is fulfilled.</returns> public bool isFulfilled(WorldModel model) { foreach (KeyValuePair <string, bool> item in conditions) { if (item.Value != model.getCondition(item.Key)) { return(false); } } return(true); }
public int getNumUnmetConditions(WorldModel model) { int numUnmetConditions = 0; foreach (KeyValuePair <string, bool> item in conditions) { if (model.getCondition(item.Key) != item.Value) { ++numUnmetConditions; } } return(numUnmetConditions); }
public bool isPossible(WorldModel model) { foreach (KeyValuePair <string, bool> item in preconditions) { bool?modelIs = model.getCondition(item.Key); if (modelIs == null) { continue; } if (item.Value != modelIs) { return(false); } } return(true); }