Example rules to enable/disable challenges (feeds fitness evaluator).
This commit is contained in:
@@ -1110,7 +1110,7 @@ public class PCGLevel extends Level {
|
||||
System.out.println("Generating level for component list: ");
|
||||
LevelParseTree parseTree = grammar.generateRandomTree(seed, width);
|
||||
|
||||
int MAX_REGENS = 10;
|
||||
int MAX_REGENS = 30;
|
||||
int nRegens = 0;
|
||||
while (!FitnessEvaluator.isFit(parseTree, profile, archetype)
|
||||
&& nRegens < MAX_REGENS) {
|
||||
@@ -1120,13 +1120,18 @@ public class PCGLevel extends Level {
|
||||
nRegens++;
|
||||
}
|
||||
|
||||
List<LevelComponent> levelTemplate = parseTree.getLevelTemplate();
|
||||
|
||||
if (nRegens == MAX_REGENS) {
|
||||
System.out.println("Failed to generate a fit level after "
|
||||
+ nRegens + " attempts. Proceeding with unfit level.");
|
||||
} else {
|
||||
System.out.println("Found fit level:");
|
||||
for (LevelComponent lc : levelTemplate) {
|
||||
System.out.println(lc);
|
||||
}
|
||||
}
|
||||
|
||||
List<LevelComponent> levelTemplate = parseTree.getLevelTemplate();
|
||||
|
||||
for (LevelComponent lcomp : levelTemplate) {
|
||||
LevelComponent.TYPE lctype = lcomp.getType();
|
||||
System.out.println("Building for: " + lcomp);
|
||||
@@ -1162,7 +1167,6 @@ public class PCGLevel extends Level {
|
||||
break;
|
||||
case POWER_UP :
|
||||
length += buildFreebie(length, width - 64 - length);
|
||||
//length += buildStraight(length, lcomp.getEnd(), true);
|
||||
break;
|
||||
case SINGLE_PIT :
|
||||
length += buildSinglePit(length, width - 64 - length);
|
||||
|
||||
Reference in New Issue
Block a user