Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Grammar.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Grammar.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Grammar.cs	(revision 10014)
@@ -20,4 +20,5 @@
 #endregion
 
+using System.Linq;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -29,4 +30,12 @@
   [Item("Robocode Grammar", "The grammar for the Robocode GP problem.")]
   public class Grammar : SymbolicExpressionGrammar {
+    private const string EventsName = "Events";
+    private const string ExpressionsName = "Expressions";
+    private const string ControlStatementsName = "Control Statements";
+    private const string RobocodeFunctionsName = "Robocode Functions";
+    private const string RelationalOperatorsName = "Relational Operators";
+    private const string LogicalOperators = "Logical Operators";
+    private const string NumericalOperatorsName = "Numerical Operators";
+
     [StorableConstructor]
     protected Grammar(bool deserializing) : base(deserializing) { }
@@ -113,41 +122,37 @@
 
       #region Symbol Collections
-      var eventSymbols = new ISymbol[] { onScannedRobot, onBulletHit, onBulletMissed, onHitByBullet, onHitRobot, onHitWall };
       var controlSymbols = new ISymbol[] { ifStat, whileStat };
-      var functionSymbols = new ISymbol[] {
+      var actionSymbols = new ISymbol[] {
         ahead, back, fire, turnGunLeft, turnGunRight, turnLeft, turnRadarLeft, turnRadarRight, turnRight
         //setAdjustGunForRobotTurn, setAdjustRadarForGunTurn, setAdjustRadarForRobotTurn, 
       };
-      var relationalOperators = new ISymbol[] { equal, lessThan, lessThanOrEqual, greaterThan, greaterThanOrEqual };
-      var logicalOperators = new ISymbol[] { conjunction, disjunction, negation };
-      var numericalExpressions = new ISymbol[] { number, getEnergy, getGunHeading, getHeading, getRadarHeading, getX, getY };
-      var numericalOperators = new ISymbol[] { addition, subtraction, multiplication, division, modulus };
+      var functionSymbols = new ISymbol[] {
+        getEnergy, getGunHeading, getHeading, getRadarHeading, getX, getY
+      };
+
+      var events = new GroupSymbol(EventsName, new ISymbol[] { onScannedRobot, onBulletHit, onBulletMissed, onHitByBullet, onHitRobot, onHitWall });
+      var controlStatements = new GroupSymbol(ControlStatementsName, controlSymbols.Concat(new[] { elseStat }));
+      var expressions = new GroupSymbol(ExpressionsName, new ISymbol[] { logicalExpr, numericalExpr });
+      var robocodeFunctions = new GroupSymbol(RobocodeFunctionsName, actionSymbols.Concat(functionSymbols));
+      var relationalOperators = new GroupSymbol(RelationalOperatorsName, new ISymbol[] { equal, lessThan, lessThanOrEqual, greaterThan, greaterThanOrEqual });
+      var logicalOperators = new GroupSymbol(LogicalOperators, new ISymbol[] { conjunction, disjunction, negation });
+      var numericalOperators = new GroupSymbol(NumericalOperatorsName, new ISymbol[] { addition, subtraction, multiplication, division, modulus });
       #endregion
 
       #region Adding Symbols
-      foreach (var s in eventSymbols)
-        AddSymbol(s);
-      foreach (var s in controlSymbols)
-        AddSymbol(s);
-      foreach (var s in functionSymbols)
-        AddSymbol(s);
-      foreach (var s in relationalOperators)
-        AddSymbol(s);
-      foreach (var s in logicalOperators)
-        AddSymbol(s);
-      foreach (var s in numericalExpressions)
-        AddSymbol(s);
-      foreach (var s in numericalOperators)
-        AddSymbol(s);
-
+      AddSymbol(tank);
+      AddSymbol(run);
+      AddSymbol(stat);
       AddSymbol(block);
-      AddSymbol(stat);
-      AddSymbol(elseStat);
       AddSymbol(shotPower);
+      AddSymbol(number);
       AddSymbol(logicalVal);
-      AddSymbol(logicalExpr);
-      AddSymbol(numericalExpr);
-      AddSymbol(run);
-      AddSymbol(tank);
+      AddSymbol(events);
+      AddSymbol(expressions);
+      AddSymbol(controlStatements);
+      AddSymbol(robocodeFunctions);
+      AddSymbol(relationalOperators);
+      AddSymbol(logicalOperators);
+      AddSymbol(numericalOperators);
       AddSymbol(emptyEvent);
       AddSymbol(doNothing);
@@ -171,5 +176,5 @@
 
       // Event
-      foreach (var s in eventSymbols)
+      foreach (var s in events.Symbols)
         AddAllowedChildSymbol(s, stat);
 
@@ -182,5 +187,5 @@
       foreach (var s in controlSymbols)
         AddAllowedChildSymbol(stat, s);
-      foreach (var s in functionSymbols)
+      foreach (var s in robocodeFunctions.Symbols)
         AddAllowedChildSymbol(stat, s);
       AddAllowedChildSymbol(stat, emptyEvent);
@@ -208,11 +213,11 @@
 
       // Numerical Expressions
-      foreach (var s in numericalExpressions)
+      foreach (var s in functionSymbols.Concat(new[] { number }))
         AddAllowedChildSymbol(numericalExpr, s);
-      foreach (var s in numericalOperators) {
+      foreach (var s in numericalOperators.Symbols) {
         AddAllowedChildSymbol(numericalExpr, s);
-        foreach (var ne in numericalExpressions)
+        foreach (var ne in functionSymbols.Concat(new[] { number }))
           AddAllowedChildSymbol(s, ne);
-        foreach (var no in numericalOperators) {
+        foreach (var no in numericalOperators.Symbols) {
           AddAllowedChildSymbol(s, no);
         }
@@ -221,21 +226,19 @@
       // Logical Expressions
       AddAllowedChildSymbol(logicalExpr, logicalVal);
-      foreach (var s in logicalOperators) {
+      foreach (var s in logicalOperators.Symbols) {
         AddAllowedChildSymbol(logicalExpr, s);
         AddAllowedChildSymbol(s, logicalVal);
-        foreach (var lo in logicalOperators)
+        foreach (var lo in logicalOperators.Symbols)
           AddAllowedChildSymbol(s, lo);
-        foreach (var ro in relationalOperators)
+        foreach (var ro in relationalOperators.Symbols)
           AddAllowedChildSymbol(s, ro);
       }
-      foreach (var s in relationalOperators)
+      foreach (var s in relationalOperators.Symbols)
         AddAllowedChildSymbol(s, numericalExpr);
 
       // Functions
-      foreach (var f in functionSymbols) {
-        if (f is Fire)
-          AddAllowedChildSymbol(f, shotPower);
-        else
-          AddAllowedChildSymbol(f, numericalExpr);
+      foreach (var f in robocodeFunctions.Symbols) {
+        if (f is Fire) AddAllowedChildSymbol(f, shotPower);
+        else AddAllowedChildSymbol(f, numericalExpr);
       }
       #endregion
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/RobocodeProblem.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/RobocodeProblem.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/RobocodeProblem.cs	(revision 10014)
@@ -76,5 +76,5 @@
 
     public RobocodeProblem()
-      : base(new RobocodeEvaluator(), new RampedHalfAndHalfTreeCreator()) {
+      : base(new RobocodeEvaluator(), new ProbabilisticTreeCreator()) {
       DirectoryValue robocodeDir = new DirectoryValue();
       robocodeDir.Value = @"C:\robocode";
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Event Methods/Events/EmptyEvent.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Event Methods/Events/EmptyEvent.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Event Methods/Events/EmptyEvent.cs	(revision 10014)
@@ -48,5 +48,5 @@
 
     public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) {
-      return ";";
+      return string.Empty;
     }
   }
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Stat.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Stat.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Stat.cs	(revision 10014)
@@ -43,5 +43,8 @@
     protected Stat(Stat original, Cloner cloner) : base(original, cloner) { }
 
-    public Stat() : base("Statement", "A statement.") { }
+    public Stat()
+      : base("Statement", "A statement.") {
+      Suffix = ";";
+    }
 
     public override IDeepCloneable Clone(Cloner cloner) {
@@ -50,5 +53,5 @@
 
     public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) {
-      return children.Aggregate(string.Empty, (current, c) => current + (Environment.NewLine + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees)));
+      return children.Aggregate(string.Empty, (current, c) => current + (Environment.NewLine + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees))) + Suffix;
     }
   }
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Statements/ElseStat.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Statements/ElseStat.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Statements/ElseStat.cs	(revision 10014)
@@ -44,7 +44,7 @@
 
     public ElseStat()
-      : base("ElseStatement", "An ElseStatement.") {
-      Prefix = "else";
-      Suffix = "";
+      : base("ElseStat", "An else branch.") {
+      Prefix = " else {";
+      Suffix = "}";
     }
 
@@ -55,7 +55,5 @@
     public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) {
       string result = children.Aggregate(string.Empty, (current, c) => current + (Environment.NewLine + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees)));
-      return string.IsNullOrEmpty(result)
-        ? string.Empty
-        : Prefix + Environment.NewLine + result + Environment.NewLine + Suffix;
+      return string.IsNullOrEmpty(result) ? string.Empty : Prefix + Environment.NewLine + result + Environment.NewLine + Suffix;
     }
   }
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Statements/IfStat.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Statements/IfStat.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Statements/IfStat.cs	(revision 10014)
@@ -43,7 +43,7 @@
 
     public IfStat()
-      : base("IfStatement", "An if statement.") {
+      : base("IfStat", "An if statement.") {
       Prefix = "if (";
-      Suffix = ")";
+      Suffix = ") {";
     }
 
@@ -63,5 +63,7 @@
         else throw new ArgumentException("Unexpected children.", "children");
       }
-      return Prefix + condition + Suffix + Environment.NewLine + ifTrue + Environment.NewLine + ifElse + Environment.NewLine;
+      string result = Prefix + condition + Suffix + Environment.NewLine + ifTrue + Environment.NewLine + "}";
+      result += string.IsNullOrEmpty(ifElse) ? Environment.NewLine : ifElse;
+      return result;
     }
   }
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Statements/WhileStat.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Statements/WhileStat.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Statements/WhileStat.cs	(revision 10014)
@@ -45,5 +45,5 @@
       : base("WhileStat", "A while statement.") {
       Prefix = "while (";
-      Suffix = ")";
+      Suffix = ") {";
     }
 
@@ -61,5 +61,5 @@
         else throw new ArgumentException("Unexpected children.", "children");
       }
-      return Prefix + condition + Suffix + Environment.NewLine + ifTrue + Environment.NewLine;
+      return Prefix + condition + Suffix + Environment.NewLine + ifTrue + Environment.NewLine + "}" + Environment.NewLine;
     }
   }
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/Ahead.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/Ahead.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/Ahead.cs	(revision 10014)
@@ -44,5 +44,5 @@
       : base("Ahead", "Immediately moves your robot ahead (forward) by distance measured in pixels.") {
       Prefix = "setAhead(";
-      Suffix = ");";
+      Suffix = ")";
     }
 
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/Back.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/Back.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/Back.cs	(revision 10014)
@@ -44,5 +44,5 @@
       : base("Back", "Immediately moves your robot backward by distance measured in pixels.") {
       Prefix = "setBack(";
-      Suffix = ");";
+      Suffix = ")";
     }
 
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/DoNothing.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/DoNothing.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/DoNothing.cs	(revision 10014)
@@ -48,5 +48,5 @@
 
     public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) {
-      return ";";
+      return string.Empty;
     }
   }
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/Fire.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/Fire.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/Fire.cs	(revision 10014)
@@ -44,5 +44,5 @@
       : base("Fire", "Immediately fires a bullet.") {
       Prefix = "setFire(";
-      Suffix = ");";
+      Suffix = ")";
     }
 
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnGunLeft.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnGunLeft.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnGunLeft.cs	(revision 10014)
@@ -44,5 +44,5 @@
       : base("TurnGunLeft", "Immediately turns the robot's gun to the left by degrees.") {
       Prefix = "setTurnGunLeft(";
-      Suffix = ");";
+      Suffix = ")";
     }
 
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnGunRight.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnGunRight.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnGunRight.cs	(revision 10014)
@@ -44,5 +44,5 @@
       : base("TurnGunRight", "Immediately turns the robot's gun to the right by degrees.") {
       Prefix = "setTurnGunRight(";
-      Suffix = ");";
+      Suffix = ")";
     }
 
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnLeft.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnLeft.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnLeft.cs	(revision 10014)
@@ -44,5 +44,5 @@
       : base("TurnLeft", "Immediately turns the robot's body to the left by degrees.") {
       Prefix = "setTurnLeft(";
-      Suffix = ");";
+      Suffix = ")";
     }
 
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnRadarLeft.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnRadarLeft.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnRadarLeft.cs	(revision 10014)
@@ -44,5 +44,5 @@
       : base("TurnRadarLeft", "Immediately turns the robot's radar to the left by degrees.") {
       Prefix = "setTurnRadarLeft(";
-      Suffix = ");";
+      Suffix = ")";
     }
 
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnRadarRight.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnRadarRight.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnRadarRight.cs	(revision 10014)
@@ -44,5 +44,5 @@
       : base("TurnRadarRight", "Immediately turns the robot's radar to the right by degrees.") {
       Prefix = "setTurnRadarRight(";
-      Suffix = ");";
+      Suffix = ")";
     }
 
Index: branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnRight.cs
===================================================================
--- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnRight.cs	(revision 10011)
+++ branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnRight.cs	(revision 10014)
@@ -44,5 +44,5 @@
       : base("TurnRight", "Immediately turns the robot's body to the right by degrees.") {
       Prefix = "setTurnRight(";
-      Suffix = ");";
+      Suffix = ")";
     }
 
