CHALLENGE rule randomly generates challenges.

This commit is contained in:
Woody Folsom
2012-03-18 16:17:04 -04:00
parent c2465821f3
commit 862ba2aa31
5 changed files with 75 additions and 7 deletions

View File

@@ -9,6 +9,6 @@ public class FitnessEvaluator {
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() > 7 && levelTemplate.size() < 17;
return levelTemplate.size() > 9 && levelTemplate.size() < 25;
}
}

View File

@@ -2,7 +2,26 @@ package dk.itu.mario.level;
public class LevelComponent {
public enum TYPE {
BLOCKS, COINS, FLAT_HI, FLAT_LO, FLAT_SAFE, HI_LO, HI_PATH, LEVEL_SEGMENT, LEVEL, LO_HI, LO_PATH, MAZE, PIPE_JUMP, PLATFORM_JUMP, POWER_UP
BLOCKS,
BOWLING_ALLEY,
CANNON_LINE,
COIN_DIVE,
FLAT_HI,
FLAT_LO,
FLAT_SAFE,
HI_LO,
HI_PATH,
LEMMING_TRAP,
LEVEL_SEGMENT,
LEVEL,
LO_HI,
LO_PATH,
MAZE,
PIPE_JUMP,
PLATFORM_JUMP,
POWER_UP,
SINGLE_PIT,
CHALLENGE
};
public enum MazeLevel {

View File

@@ -1145,6 +1145,28 @@ public class PCGLevel extends Level {
case MAZE:
length += buildMaze(length, width - 64 - length);
break;
case BLOCKS:
length += buildMaze(length, width - 64 - length);
break;
case BOWLING_ALLEY :
length += buildBowlingAlley(length, width - 64 - length);
break;
case CANNON_LINE :
length += buildCannonLine(length, width - 64 - length);
break;
case COIN_DIVE :
length += buildCoinDive(length, width - 64 - length);
break;
case LEMMING_TRAP :
length += buildLemmingTrap(length, width - 64 - length);
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);
break;
default:
System.out
.println("Cannot build level segment for unrecognized LevelComponent type: "

View File

@@ -83,6 +83,9 @@ public class LevelGrammarFactory {
}
String remainder = clause.substring(rBraceIndex);
if (remainder.startsWith("}, ")) {
remainder = remainder.substring(3);
}
List<String> rhsClauseStrings = new ArrayList<String>();
if (remainder.contains("(")) {
int nextLeftIndex = -1;