Rete-based rule system (Drools) correctly fires the appropriate actions when Player's Profile meets certain criteria, based on the rules in rules/LevelTunerRules.drl.

This commit is contained in:
Woody Folsom
2012-03-17 18:08:56 -04:00
parent 1d9eae7af0
commit 109c2d099a
14 changed files with 153 additions and 143 deletions

View File

@@ -1,7 +0,0 @@
package org.drools.examples.simple;
rule "Account balance is less than 100"
when
$account : Account( balance < 100 ) // condition
then
System.out.println("Account number: " + $account.getId() + " is below 100"); // consequence
end

17
rules/LevelTunerRules.drl Normal file
View File

@@ -0,0 +1,17 @@
package dk.itu.mario.level;
rule "NoviceJumper"
when
playerProfile : PlayerProfile( jumpSkill <= 20 ) // condition
then
System.out.println("PlayerProfile indicates NoviceJumper. Disabling Pipe challenge."); // consequence
playerProfile.setDisabled(LevelComponent.TYPE.PIPE_JUMP);
end
rule "BeginnerJumper"
when
playerProfile : PlayerProfile( jumpSkill > 20 ) // condition
then
System.out.println("PlayerProfile indicates Beginner (or better) Jumper. Pipe challenge enabled!"); // consequence
playerProfile.setEnabled(LevelComponent.TYPE.PIPE_JUMP);
end