Example rules to enable/disable challenges (feeds fitness evaluator).

This commit is contained in:
Woody Folsom
2012-03-18 16:41:23 -04:00
parent 862ba2aa31
commit 992f2eef46
4 changed files with 59 additions and 30 deletions

View File

@@ -8,7 +8,23 @@ public class FitnessEvaluator {
public static boolean isFit(LevelParseTree parseTree, PlayerProfile playerProfile, LevelArchetype levelArchetype) {
System.out.println("Evaluating LevelParseTree for fitness");
List<LevelComponent> levelTemplate = parseTree.getLevelTemplate();
//a good level has 8-16 components, plus some additional complexity depending on the player's skill level
return levelTemplate.size() > 9 && levelTemplate.size() < 25;
//a good level has 8-24 components, plus some additional complexity depending on the player's skill level
if (levelTemplate.size() < 8) {
return false;
}
if (levelTemplate.size() > 24) {
return false;
}
for (LevelComponent lc : levelTemplate) {
if (!playerProfile.isEnabled(lc.getType())) {
System.out.println("Level is not fit: " + lc.getType() + " is not enabled.");
return false;
}
}
return true;
}
}