Example rules to enable/disable challenges (feeds fitness evaluator).
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user