Index: anches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Crossover/RobocodeCrossover.cs
===================================================================
--- /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Crossover/RobocodeCrossover.cs	(revision 9878)
+++ 	(revision )
@@ -1,208 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Problems.Robocode {
-  /// <summary>
-  /// Takes two parent individuals P0 and P1 each. Selects a random node N0 of P0 and a random node N1 of P1.
-  /// And replaces the branch with root0 N0 in P0 with N1 from P1 if the tree-size limits are not violated.
-  /// When recombination with N0 and N1 would create a tree that is too large or invalid the operator randomly selects new N0 and N1 
-  /// until a valid configuration is found.
-  /// </summary>  
-  [Item("RobocodeCrossover", "An operator which performs subtree swapping crossover.")]
-  [StorableClass]
-  public class RobocodeCrossover : SymbolicExpressionTreeCrossover, ISymbolicExpressionTreeSizeConstraintOperator {
-    private const string InternalCrossoverPointProbabilityParameterName = "InternalCrossoverPointProbability";
-    private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
-    private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
-
-    #region Parameter Properties
-    public IValueLookupParameter<PercentValue> InternalCrossoverPointProbabilityParameter {
-      get { return (IValueLookupParameter<PercentValue>)Parameters[InternalCrossoverPointProbabilityParameterName]; }
-    }
-    public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {
-      get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; }
-    }
-    public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter {
-      get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; }
-    }
-    #endregion
-    #region Properties
-    public PercentValue InternalCrossoverPointProbability {
-      get { return InternalCrossoverPointProbabilityParameter.ActualValue; }
-    }
-    public IntValue MaximumSymbolicExpressionTreeLength {
-      get { return MaximumSymbolicExpressionTreeLengthParameter.ActualValue; }
-    }
-    public IntValue MaximumSymbolicExpressionTreeDepth {
-      get { return MaximumSymbolicExpressionTreeDepthParameter.ActualValue; }
-    }
-    #endregion
-    [StorableConstructor]
-    protected RobocodeCrossover(bool deserializing) : base(deserializing) { }
-    protected RobocodeCrossover(RobocodeCrossover original, Cloner cloner) : base(original, cloner) { }
-    public RobocodeCrossover()
-      : base() {
-      Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "The maximal length (number of nodes) of the symbolic expression tree."));
-      Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0)."));
-      Parameters.Add(new ValueLookupParameter<PercentValue>(InternalCrossoverPointProbabilityParameterName, "The probability to select an internal crossover point (instead of a leaf node).", new PercentValue(0.9)));
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new RobocodeCrossover(this, cloner);
-    }
-
-    public override ISymbolicExpressionTree Crossover(IRandom random,
-      ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1) {
-      return Cross(random, parent0, parent1, InternalCrossoverPointProbability.Value,
-        MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value);
-    }
-
-    public static ISymbolicExpressionTree Cross(IRandom random,
-      ISymbolicExpressionTree parent0, ISymbolicExpressionTree parent1,
-      double internalCrossoverPointProbability, int maxTreeLength, int maxTreeDepth) {
-      // select a random crossover point in the first parent 
-      CutPoint crossoverPoint0;
-      SelectCrossoverPoint(random, parent0, internalCrossoverPointProbability, maxTreeLength, maxTreeDepth, out crossoverPoint0);
-
-      int childLength = crossoverPoint0.Child != null ? crossoverPoint0.Child.GetLength() : 0;
-      // calculate the max length and depth that the inserted branch can have 
-      int maxInsertedBranchLength = maxTreeLength - (parent0.Length - childLength);
-      int maxInsertedBranchDepth = maxTreeDepth - parent0.Root.GetBranchLevel(crossoverPoint0.Parent);
-
-      List<ISymbolicExpressionTreeNode> allowedBranches = new List<ISymbolicExpressionTreeNode>();
-      parent1.Root.ForEachNodePostfix((n) => {
-        if (n.GetLength() <= maxInsertedBranchLength &&
-            n.GetDepth() <= maxInsertedBranchDepth && crossoverPoint0.IsMatchingPointType(n))
-          allowedBranches.Add(n);
-      });
-      // empty branch
-      if (crossoverPoint0.IsMatchingPointType(null)) allowedBranches.Add(null);
-
-      if (allowedBranches.Count == 0) {
-        return parent0;
-      } else {
-        var selectedBranch = SelectRandomBranch(random, allowedBranches, internalCrossoverPointProbability);
-
-        if (crossoverPoint0.Child != null) {
-          // manipulate the tree of parent0 in place
-          // replace the branch in tree0 with the selected branch from tree1
-          crossoverPoint0.Parent.RemoveSubtree(crossoverPoint0.ChildIndex);
-          if (selectedBranch != null) {
-            crossoverPoint0.Parent.InsertSubtree(crossoverPoint0.ChildIndex, selectedBranch);
-          }
-        } else {
-          // child is null (additional child should be added under the parent)
-          if (selectedBranch != null) {
-            crossoverPoint0.Parent.AddSubtree(selectedBranch);
-          }
-        }
-        return parent0;
-      }
-    }
-
-    private static void SelectCrossoverPoint(IRandom random, ISymbolicExpressionTree parent0, double internalNodeProbability, int maxBranchLength, int maxBranchDepth, out CutPoint crossoverPoint) {
-      if (internalNodeProbability < 0.0 || internalNodeProbability > 1.0) throw new ArgumentException("internalNodeProbability");
-      List<CutPoint> internalCrossoverPoints = new List<CutPoint>();
-      List<CutPoint> leafCrossoverPoints = new List<CutPoint>();
-      parent0.Root.ForEachNodePostfix((n) => {
-        if (n.SubtreeCount > 0 && n != parent0.Root) {
-          foreach (var child in n.Subtrees) {
-            if (child.GetLength() <= maxBranchLength &&
-                child.GetDepth() <= maxBranchDepth) {
-              if (child.SubtreeCount > 0)
-                internalCrossoverPoints.Add(new CutPoint(n, child));
-              else
-                leafCrossoverPoints.Add(new CutPoint(n, child));
-            }
-          }
-
-          // add one additional extension point if the number of sub trees for the symbol is not full
-          if (n.SubtreeCount < n.Grammar.GetMaximumSubtreeCount(n.Symbol)) {
-            // empty extension point
-            internalCrossoverPoints.Add(new CutPoint(n, n.SubtreeCount));
-          }
-        }
-      }
-    );
-
-      if (random.NextDouble() < internalNodeProbability) {
-        // select from internal node if possible
-        if (internalCrossoverPoints.Count > 0) {
-          // select internal crossover point or leaf
-          crossoverPoint = internalCrossoverPoints[random.Next(internalCrossoverPoints.Count)];
-        } else {
-          // otherwise select external node
-          crossoverPoint = leafCrossoverPoints[random.Next(leafCrossoverPoints.Count)];
-        }
-      } else if (leafCrossoverPoints.Count > 0) {
-        // select from leaf crossover point if possible
-        crossoverPoint = leafCrossoverPoints[random.Next(leafCrossoverPoints.Count)];
-      } else {
-        // otherwise select internal crossover point
-        crossoverPoint = internalCrossoverPoints[random.Next(internalCrossoverPoints.Count)];
-      }
-    }
-
-    private static ISymbolicExpressionTreeNode SelectRandomBranch(IRandom random, IEnumerable<ISymbolicExpressionTreeNode> branches, double internalNodeProbability) {
-      if (internalNodeProbability < 0.0 || internalNodeProbability > 1.0) throw new ArgumentException("internalNodeProbability");
-      List<ISymbolicExpressionTreeNode> allowedInternalBranches;
-      List<ISymbolicExpressionTreeNode> allowedLeafBranches;
-      if (random.NextDouble() < internalNodeProbability) {
-        // select internal node if possible
-        allowedInternalBranches = (from branch in branches
-                                   where branch != null && branch.SubtreeCount > 0
-                                   select branch).ToList();
-        if (allowedInternalBranches.Count > 0) {
-          return allowedInternalBranches.SelectRandom(random);
-        } else {
-          // no internal nodes allowed => select leaf nodes
-          allowedLeafBranches = (from branch in branches
-                                 where branch == null || branch.SubtreeCount == 0
-                                 select branch).ToList();
-          return allowedLeafBranches.SelectRandom(random);
-        }
-      } else {
-        // select leaf node if possible
-        allowedLeafBranches = (from branch in branches
-                               where branch == null || branch.SubtreeCount == 0
-                               select branch).ToList();
-        if (allowedLeafBranches.Count > 0) {
-          return allowedLeafBranches.SelectRandom(random);
-        } else {
-          allowedInternalBranches = (from branch in branches
-                                     where branch != null && branch.SubtreeCount > 0
-                                     select branch).ToList();
-          return allowedInternalBranches.SelectRandom(random);
-        }
-      }
-    }
-  }
-}
Index: anches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Evaluator.cs
===================================================================
--- /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Evaluator.cs	(revision 9878)
+++ 	(revision )
@@ -1,165 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-
-using System;
-using System.Threading;
-using System.Xml;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Operators;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-
-namespace HeuristicLab.Problems.Robocode {
-  [StorableClass]
-  [Item("Robocode Evaluator", "Evaluator for the Robocode GP problem.")]
-  public class Evaluator : SingleSuccessorOperator,
-    ISingleObjectiveEvaluator {
-    #region parameter names
-    private const string QualityParameterName = "Quality";
-    private const string TankProgramParameterName = "TankProgram";
-    private const string RobocodePathParamaterName = "Path";
-    private const string CoevolutionParameterName = "Coevolution";
-
-
-    private static string solutionTemplatePath = "";
-    public static string SolutionTemplate {
-      get { return solutionTemplatePath; }
-      set {
-        solutionTemplatePath = value;
-      }
-    }
-
-    public static SemaphoreSlim semaphore = new SemaphoreSlim(10);
-    #endregion
-
-
-    #region parameters
-    public ILookupParameter<DoubleValue> QualityParameter {
-      get {
-        return (ILookupParameter<DoubleValue>)
-                 Parameters[QualityParameterName];
-      }
-    }
-    public ILookupParameter<ISymbolicExpressionTree> TankProgramParameter {
-      get {
-        return (ILookupParameter<ISymbolicExpressionTree>)
-                 Parameters[TankProgramParameterName];
-      }
-    }
-    public ILookupParameter<StringValue> RobocodePathParameter {
-      get {
-        return (ILookupParameter<StringValue>)
-            Parameters[RobocodePathParamaterName];
-      }
-    }
-    public ILookupParameter<BoolValue> CoevolutionParameter {
-      get {
-        return (ILookupParameter<BoolValue>)
-            Parameters[CoevolutionParameterName];
-      }
-    }
-    #endregion
-
-
-    [StorableConstructor]
-    protected Evaluator(bool deserializing) : base(deserializing) { }
-    protected Evaluator(Evaluator original, Cloner cloner)
-      : base(original, cloner) {
-    }
-
-    // default constructor for the evaluator
-    public Evaluator() {
-      Parameters.Add(
-        new LookupParameter<DoubleValue>(
-          QualityParameterName,
-          "The solution quality of the Robocode tank program."));
-      Parameters.Add(
-        new LookupParameter<ISymbolicExpressionTree>(
-          TankProgramParameterName,
-          "The Robocode tank program to evaluate represented as a " +
-          "symbolic expression tree."));
-      Parameters.Add(
-        new LookupParameter<StringValue>(
-          RobocodePathParamaterName,
-          "Path of the Robocode installation."));
-      Parameters.Add(
-          new LookupParameter<BoolValue>(
-              CoevolutionParameterName,
-              "Use Coevolution"));
-
-      SolutionTemplate = "../tank.xml";
-    }
-
-    // override the apply method to change the behaviour of the operator
-    // here we take trees as inputs and calculate qualities 
-    // (fitness evaluation)
-    public override IOperation Apply() {
-      semaphore.Wait();
-
-      ISymbolicExpressionTree tree = TankProgramParameter.ActualValue;
-      //XmlDocument doc = new XmlDocument();
-      //doc.Load("../tank.xml");
-      XmlNode node = null;
-      string path = RobocodePathParameter.ActualValue.Value;
-
-      if (CoevolutionParameter.ActualValue.Value) {
-        var trees = ExecutionContext.Parent.Scope.SubScopes;//SymbolicExpressionTreeParameter.ActualValue;
-        if (trees.Count == 2) {
-          trees = trees[0].SubScopes;
-          //treeCount = trees[0].SubScopes.Count;
-          //int selTreeCount = trees[1].SubScopes.Count;
-        }
-
-        Random random = new Random();
-        ScopeList chosenScopes = new ScopeList(5);
-        for (int i = 0; i < 5; i++) {
-          var newScope = trees.ToArray()[random.Next(0, trees.Count - 1)];
-          chosenScopes.Add(newScope);
-        }
-
-        //if (evaluations % 99 == 0)
-        //    evaluations = evaluations;
-
-        QualityParameter.ActualValue = new DoubleValue(Interpreter.EvaluateTankProgram(tree, chosenScopes, node, path));
-      } else
-        QualityParameter.ActualValue = new DoubleValue(Interpreter.EvaluateTankProgram(tree, node, path));
-
-      semaphore.Release();
-
-      // important: return base.Apply() to make sure that the
-      // next operator is queued for execution
-      return base.Apply();
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new Evaluator(this, cloner);
-    }
-
-    public bool EnabledByDefault {
-      get { return true; }
-    }
-  }
-}
Index: /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Grammar.cs
===================================================================
--- /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Grammar.cs	(revision 9878)
+++ /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Grammar.cs	(revision 9879)
@@ -79,5 +79,4 @@
       var ahead = new Ahead();
       var back = new Back();
-      var constant = new Constant();
       var doNothing = new DoNothing();
       var fire = new Fire();
@@ -156,5 +155,5 @@
       var constantSymbols = new List<ISymbol>()
             {
-                shotPower, /*independent,*/ constant
+                shotPower
             };
 
@@ -247,9 +246,5 @@
       // Add the appropriate parameters as children of their respective functions
       foreach (var f in functionSymbols) {
-        if (f is SetAdjustGunForRobotTurn ||
-            f is SetAdjustRadarForGunTurn ||
-            f is SetAdjustRadarForRobotTurn)
-          AddAllowedChildSymbol(f, logicExpr);
-        else if (f is Fire)
+        if (f is Fire)
           AddAllowedChildSymbol(f, shotPower);
         else
Index: /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/HeuristicLab.Problems.Robocode-3.3.csproj
===================================================================
--- /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/HeuristicLab.Problems.Robocode-3.3.csproj	(revision 9878)
+++ /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/HeuristicLab.Problems.Robocode-3.3.csproj	(revision 9879)
@@ -95,10 +95,9 @@
     <None Include="HeuristicLab.snk" />
     <None Include="Plugin.cs.frame" />
-    <Compile Include="Crossover\RobocodeCrossover.cs" />
     <Compile Include="Crossover\RobocodeMethodCrossover.cs" />
-    <Compile Include="Evaluator.cs" />
+    <Compile Include="RobocodeEvaluator.cs" />
     <Compile Include="Grammar.cs" />
     <Compile Include="Interpreter.cs" />
-    <Compile Include="Problem.cs" />
+    <Compile Include="RobocodeProblem.cs" />
     <None Include="Properties\AssemblyInfo.cs.frame" />
     <Compile Include="Solution.cs" />
@@ -112,6 +111,4 @@
     <Compile Include="Symbols\Branches\WhileLoop.cs" />
     <Compile Include="Symbols\Logical Expressions\BooleanTreeNode.cs" />
-    <Compile Include="Symbols\Abandoned\Constant.cs" />
-    <Compile Include="Symbols\Abandoned\ConstantTreeNode.cs" />
     <Compile Include="Symbols\Logical Expressions\Logical Comparators\Conjunction.cs" />
     <Compile Include="Symbols\Logical Expressions\Logical Comparators\Disjunction.cs" />
@@ -153,10 +150,6 @@
     <Compile Include="Symbols\Numerical Methods\GetX.cs" />
     <Compile Include="Symbols\Numerical Methods\GetY.cs" />
-    <Compile Include="Symbols\Abandoned\Independent.cs" />
     <Compile Include="Symbols\Program.cs" />
     <Compile Include="Symbols\Event Methods\Run.cs" />
-    <Compile Include="Symbols\Abandoned\SetAdjustGunForRobotTurn.cs" />
-    <Compile Include="Symbols\Abandoned\SetAdjustRadarForGunTurn.cs" />
-    <Compile Include="Symbols\Abandoned\SetAdjustRadarForRobotTurn.cs" />
     <Compile Include="Symbols\Numerical Expressions\ShotPower.cs" />
     <Compile Include="Symbols\Numerical Expressions\ShotPowerTreeNode.cs" />
Index: /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Interpreter.cs
===================================================================
--- /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Interpreter.cs	(revision 9878)
+++ /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Interpreter.cs	(revision 9879)
@@ -295,7 +295,5 @@
           tankStats = EvaluateTankProgram(node.GetSubtree(0), ref docNode, null);
       else*/
-      if (node.Symbol is Constant)
-        docNode[method]["code"].InnerText += " " + ((ConstantTreeNode)node).Value + " ";
-      else if (node.Symbol is ShotPower)
+      if (node.Symbol is ShotPower)
         docNode[method]["code"].InnerText += " " + ((ShotPowerTreeNode)node).Value + " ";
       else if (node.Symbol is LogicalValue)
@@ -329,19 +327,4 @@
       } else if (node.Symbol is Back) {
         docNode[method]["code"].InnerText += "setBack(";
-        EvaluateTankProgram(node.GetSubtree(0), docNode, method);
-        docNode[method]["code"].InnerText += ");\r\n";
-        tankStats.moves = 1;
-      } else if (node.Symbol is SetAdjustGunForRobotTurn) {
-        docNode[method]["code"].InnerText += "setAdjustGunForRobotTurn(";
-        EvaluateTankProgram(node.GetSubtree(0), docNode, method);
-        docNode[method]["code"].InnerText += ");\r\n";
-        tankStats.moves = 1;
-      } else if (node.Symbol is SetAdjustRadarForGunTurn) {
-        docNode[method]["code"].InnerText += "setAdjustRadarForGunTurn(";
-        EvaluateTankProgram(node.GetSubtree(0), docNode, method);
-        docNode[method]["code"].InnerText += ");\r\n";
-        tankStats.moves = 1;
-      } else if (node.Symbol is SetAdjustRadarForRobotTurn) {
-        docNode[method]["code"].InnerText += "setAdjustRadarForRobotTurn(";
         EvaluateTankProgram(node.GetSubtree(0), docNode, method);
         docNode[method]["code"].InnerText += ");\r\n";
Index: anches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Problem.cs
===================================================================
--- /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Problem.cs	(revision 9878)
+++ 	(revision )
@@ -1,200 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System.Linq;
-using HeuristicLab.Common;
-using HeuristicLab.Core;
-using HeuristicLab.Data;
-using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
-using HeuristicLab.Optimization;
-using HeuristicLab.Parameters;
-using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
-using HeuristicLab.PluginInfrastructure;
-
-namespace HeuristicLab.Problems.Robocode {
-  [StorableClass]
-  [Creatable("Problems")]
-  [Item("Robocode Problem",
-        "The Robocode problem for genetic programming.")]
-  public class Problem : SingleObjectiveHeuristicOptimizationProblem<Evaluator,
-    ISymbolicExpressionTreeCreator> {
-    #region parameter names
-    private const string TankProgramParameterName = "TankProgram";
-    private const string MaxTankProgramLengthParameterName =
-      "MaxProgramLength";
-    private const string MaxTankProgramDepthParameterName =
-      "MaxProgramDepth";
-    private const string TankGrammarParameterName = "Grammar";
-    private const string RobocodePathParamaterName = "Path";
-    private const string CoevolutionParameterName = "Coevolution";
-    #endregion
-
-    #region parameters
-    public IFixedValueParameter<IntValue> MaxTankProgramLengthParameter {
-      get {
-        return (IFixedValueParameter<IntValue>)
-          Parameters[MaxTankProgramLengthParameterName];
-      }
-    }
-    public IFixedValueParameter<IntValue> MaxTankProgramDepthParameter {
-      get {
-        return (IFixedValueParameter<IntValue>)
-          Parameters[MaxTankProgramDepthParameterName];
-      }
-    }
-    public IValueParameter<Grammar> GrammarParameter {
-      get {
-        return (IValueParameter<Grammar>)
-          Parameters[TankGrammarParameterName];
-      }
-    }
-    public IFixedValueParameter<StringValue> RobocodePathParameter {
-      get {
-        return (IFixedValueParameter<StringValue>)
-            Parameters[RobocodePathParamaterName];
-      }
-    }
-    public IFixedValueParameter<BoolValue> CoevolutionParameter {
-      get {
-        return (IFixedValueParameter<BoolValue>)
-            Parameters[CoevolutionParameterName];
-      }
-    }
-    #endregion
-
-    [StorableConstructor]
-    protected Problem(bool deserializing)
-      : base(deserializing) {
-    }
-    protected Problem(Problem original, Cloner cloner)
-      : base(original, cloner) {
-    }
-
-    // default constructor for the problem
-    // also creates the fitness evaluation operator (Evaluator), 
-    // and the tree creation operator (RampedHalfAndHalfTreeCreator)
-    public Problem()
-      : base(new Evaluator(), new RampedHalfAndHalfTreeCreator()) {
-      Parameters.Add(
-         new FixedValueParameter<IntValue>(
-           MaxTankProgramDepthParameterName,
-           "Maximal depth of the Robocode tank program.",
-           new IntValue(6)));
-      Parameters.Add(
-        new FixedValueParameter<IntValue>(
-          MaxTankProgramLengthParameterName,
-          "Maximal length of the tank program.",
-          new IntValue(1000)));
-      Parameters.Add(
-        new ValueParameter<Grammar>(
-          TankGrammarParameterName,
-          "Grammar for the tank program.",
-          new Grammar()));
-      Parameters.Add(new FixedValueParameter<StringValue>(
-          RobocodePathParamaterName,
-          "Path of the Robocode installation.",
-          new StringValue("F:/robocode2")));
-      Parameters.Add(new FixedValueParameter<BoolValue>(
-          CoevolutionParameterName,
-          "Use Coevolution", new BoolValue(false)));
-
-      Maximization.Value = true;
-      InitializeOperators();
-    }
-
-    public override IDeepCloneable Clone(Cloner cloner) {
-      return new Problem(this, cloner);
-    }
-
-    private void InitializeOperators() {
-      Operators.AddRange(
-        ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>());
-      Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer());
-      Operators.Add(new SymbolicExpressionSymbolFrequencyAnalyzer());
-      Operators.Add(new BestSolutionAnalyzer());
-      ParameterizeOperators();
-      ParameterizeAnalyzers();
-    }
-
-    protected override void OnEvaluatorChanged() {
-      base.OnEvaluatorChanged();
-      Evaluator.TankProgramParameter.ActualName =
-        TankProgramParameterName;
-      ParameterizeAnalyzers();
-      ParameterizeOperators();
-    }
-
-    protected override void OnSolutionCreatorChanged() {
-      base.OnSolutionCreatorChanged();
-      SolutionCreator.SymbolicExpressionTreeParameter.ActualName =
-        TankProgramParameterName;
-      ParameterizeAnalyzers();
-      ParameterizeOperators();
-    }
-
-    private void ParameterizeAnalyzers() {
-      var analyzers = Operators.OfType<IAnalyzer>();
-      foreach (var o in analyzers.OfType<ISymbolicExpressionTreeAnalyzer>()) {
-        o.SymbolicExpressionTreeParameter.ActualName =
-          SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
-      }
-      foreach (var o in analyzers.OfType<BestSolutionAnalyzer>()) {
-        o.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
-      }
-    }
-
-    private void ParameterizeOperators() {
-      var operators = Parameters
-        .OfType<IValueParameter>()
-        .Select(p => p.Value)
-        .OfType<IOperator>()
-        .Union(Operators);
-      foreach (var o in operators.OfType<ISymbolicExpressionTreeGrammarBasedOperator>()) {
-        o.SymbolicExpressionTreeGrammarParameter.ActualName =
-          TankGrammarParameterName;
-      }
-      foreach (var o in operators.OfType<ISymbolicExpressionTreeSizeConstraintOperator>()) {
-        o.MaximumSymbolicExpressionTreeDepthParameter.ActualName =
-          MaxTankProgramDepthParameterName;
-        o.MaximumSymbolicExpressionTreeLengthParameter.ActualName =
-          MaxTankProgramLengthParameterName;
-      }
-      foreach (var op in operators.OfType<Evaluator>()) {
-        op.TankProgramParameter.ActualName =
-          SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
-      }
-      foreach (var op in operators.OfType<ISymbolicExpressionTreeCrossover>()) {
-        op.ParentsParameter.ActualName =
-          SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
-        op.ChildParameter.ActualName =
-          SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
-      }
-      foreach (var op in operators.OfType<ISymbolicExpressionTreeManipulator>()) {
-        op.SymbolicExpressionTreeParameter.ActualName =
-          SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
-      }
-      foreach (var op in operators.OfType<ISymbolicExpressionTreeCreator>()) {
-        op.SymbolicExpressionTreeParameter.ActualName =
-          SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
-      }
-    }
-  }
-}
Index: /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/RobocodeEvaluator.cs
===================================================================
--- /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/RobocodeEvaluator.cs	(revision 9879)
+++ /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/RobocodeEvaluator.cs	(revision 9879)
@@ -0,0 +1,165 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+
+using System;
+using System.Threading;
+using System.Xml;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Problems.Robocode {
+  [StorableClass]
+  [Item("Robocode Evaluator", "Evaluator for the Robocode GP problem.")]
+  public class RobocodeEvaluator : SingleSuccessorOperator,
+    ISingleObjectiveEvaluator {
+    #region parameter names
+    private const string QualityParameterName = "Quality";
+    private const string TankProgramParameterName = "TankProgram";
+    private const string RobocodePathParamaterName = "Path";
+    private const string CoevolutionParameterName = "Coevolution";
+
+
+    private static string solutionTemplatePath = "";
+    public static string SolutionTemplate {
+      get { return solutionTemplatePath; }
+      set {
+        solutionTemplatePath = value;
+      }
+    }
+
+    public static SemaphoreSlim semaphore = new SemaphoreSlim(10);
+    #endregion
+
+
+    #region parameters
+    public ILookupParameter<DoubleValue> QualityParameter {
+      get {
+        return (ILookupParameter<DoubleValue>)
+                 Parameters[QualityParameterName];
+      }
+    }
+    public ILookupParameter<ISymbolicExpressionTree> TankProgramParameter {
+      get {
+        return (ILookupParameter<ISymbolicExpressionTree>)
+                 Parameters[TankProgramParameterName];
+      }
+    }
+    public ILookupParameter<StringValue> RobocodePathParameter {
+      get {
+        return (ILookupParameter<StringValue>)
+            Parameters[RobocodePathParamaterName];
+      }
+    }
+    public ILookupParameter<BoolValue> CoevolutionParameter {
+      get {
+        return (ILookupParameter<BoolValue>)
+            Parameters[CoevolutionParameterName];
+      }
+    }
+    #endregion
+
+
+    [StorableConstructor]
+    protected RobocodeEvaluator(bool deserializing) : base(deserializing) { }
+    protected RobocodeEvaluator(RobocodeEvaluator original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    // default constructor for the evaluator
+    public RobocodeEvaluator() {
+      Parameters.Add(
+        new LookupParameter<DoubleValue>(
+          QualityParameterName,
+          "The solution quality of the Robocode tank program."));
+      Parameters.Add(
+        new LookupParameter<ISymbolicExpressionTree>(
+          TankProgramParameterName,
+          "The Robocode tank program to evaluate represented as a " +
+          "symbolic expression tree."));
+      Parameters.Add(
+        new LookupParameter<StringValue>(
+          RobocodePathParamaterName,
+          "Path of the Robocode installation."));
+      Parameters.Add(
+          new LookupParameter<BoolValue>(
+              CoevolutionParameterName,
+              "Use Coevolution"));
+
+      SolutionTemplate = "../tank.xml";
+    }
+
+    // override the apply method to change the behaviour of the operator
+    // here we take trees as inputs and calculate qualities 
+    // (fitness evaluation)
+    public override IOperation Apply() {
+      semaphore.Wait();
+
+      ISymbolicExpressionTree tree = TankProgramParameter.ActualValue;
+      //XmlDocument doc = new XmlDocument();
+      //doc.Load("../tank.xml");
+      XmlNode node = null;
+      string path = RobocodePathParameter.ActualValue.Value;
+
+      if (CoevolutionParameter.ActualValue.Value) {
+        var trees = ExecutionContext.Parent.Scope.SubScopes;//SymbolicExpressionTreeParameter.ActualValue;
+        if (trees.Count == 2) {
+          trees = trees[0].SubScopes;
+          //treeCount = trees[0].SubScopes.Count;
+          //int selTreeCount = trees[1].SubScopes.Count;
+        }
+
+        Random random = new Random();
+        ScopeList chosenScopes = new ScopeList(5);
+        for (int i = 0; i < 5; i++) {
+          var newScope = trees.ToArray()[random.Next(0, trees.Count - 1)];
+          chosenScopes.Add(newScope);
+        }
+
+        //if (evaluations % 99 == 0)
+        //    evaluations = evaluations;
+
+        QualityParameter.ActualValue = new DoubleValue(Interpreter.EvaluateTankProgram(tree, chosenScopes, node, path));
+      } else
+        QualityParameter.ActualValue = new DoubleValue(Interpreter.EvaluateTankProgram(tree, node, path));
+
+      semaphore.Release();
+
+      // important: return base.Apply() to make sure that the
+      // next operator is queued for execution
+      return base.Apply();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new RobocodeEvaluator(this, cloner);
+    }
+
+    public bool EnabledByDefault {
+      get { return true; }
+    }
+  }
+}
Index: /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/RobocodeProblem.cs
===================================================================
--- /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/RobocodeProblem.cs	(revision 9879)
+++ /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/RobocodeProblem.cs	(revision 9879)
@@ -0,0 +1,191 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System.Linq;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.Problems.Robocode {
+  [StorableClass]
+  [Creatable("Problems")]
+  [Item("Robocode Problem",
+        "The Robocode problem for genetic programming.")]
+  public class RobocodeProblem : SingleObjectiveHeuristicOptimizationProblem<RobocodeEvaluator,
+    ISymbolicExpressionTreeCreator> {
+    #region parameter names
+    private const string TankProgramParameterName = "TankProgram";
+    private const string MaxTankProgramLengthParameterName = "MaxProgramLength";
+    private const string MaxTankProgramDepthParameterName = "MaxProgramDepth";
+    private const string TankGrammarParameterName = "Grammar";
+    private const string RobocodePathParamaterName = "Path";
+    private const string CoevolutionParameterName = "Coevolution";
+    #endregion
+
+    #region Parameters
+    public IFixedValueParameter<IntValue> MaxTankProgramLengthParameter {
+      get {
+        return (IFixedValueParameter<IntValue>)
+          Parameters[MaxTankProgramLengthParameterName];
+      }
+    }
+    public IFixedValueParameter<IntValue> MaxTankProgramDepthParameter {
+      get {
+        return (IFixedValueParameter<IntValue>)
+          Parameters[MaxTankProgramDepthParameterName];
+      }
+    }
+    public IValueParameter<Grammar> GrammarParameter {
+      get {
+        return (IValueParameter<Grammar>)
+          Parameters[TankGrammarParameterName];
+      }
+    }
+    public IFixedValueParameter<StringValue> RobocodePathParameter {
+      get {
+        return (IFixedValueParameter<StringValue>)
+            Parameters[RobocodePathParamaterName];
+      }
+    }
+    public IFixedValueParameter<BoolValue> CoevolutionParameter {
+      get {
+        return (IFixedValueParameter<BoolValue>)
+            Parameters[CoevolutionParameterName];
+      }
+    }
+    #endregion
+
+    [StorableConstructor]
+    protected RobocodeProblem(bool deserializing)
+      : base(deserializing) {
+    }
+    protected RobocodeProblem(RobocodeProblem original, Cloner cloner)
+      : base(original, cloner) {
+    }
+
+    // default constructor for the problem
+    // also creates the fitness evaluation operator (Evaluator), 
+    // and the tree creation operator (RampedHalfAndHalfTreeCreator)
+    public RobocodeProblem()
+      : base(new RobocodeEvaluator(), new RampedHalfAndHalfTreeCreator()) {
+      Parameters.Add(
+         new FixedValueParameter<IntValue>(MaxTankProgramDepthParameterName,
+           "Maximal depth of the Robocode tank program.",
+           new IntValue(6)));
+      Parameters.Add(new FixedValueParameter<IntValue>(MaxTankProgramLengthParameterName,
+          "Maximal length of the tank program.", new IntValue(1000)));
+      Parameters.Add(
+        new ValueParameter<Grammar>(TankGrammarParameterName,
+          "Grammar for the tank program.",
+          new Grammar()));
+      Parameters.Add(new FixedValueParameter<StringValue>(RobocodePathParamaterName,
+          "Path of the Robocode installation.",
+          new StringValue("F:/robocode2")));
+      Parameters.Add(new FixedValueParameter<BoolValue>(CoevolutionParameterName,
+          "Use Coevolution", new BoolValue(false)));
+
+      Maximization.Value = true;
+      InitializeOperators();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new RobocodeProblem(this, cloner);
+    }
+
+    private void InitializeOperators() {
+      Operators.AddRange(
+        ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>());
+      Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer());
+      Operators.Add(new SymbolicExpressionSymbolFrequencyAnalyzer());
+      Operators.Add(new BestSolutionAnalyzer());
+      ParameterizeOperators();
+      ParameterizeAnalyzers();
+    }
+
+    protected override void OnEvaluatorChanged() {
+      base.OnEvaluatorChanged();
+      Evaluator.TankProgramParameter.ActualName =
+        TankProgramParameterName;
+      ParameterizeAnalyzers();
+      ParameterizeOperators();
+    }
+
+    protected override void OnSolutionCreatorChanged() {
+      base.OnSolutionCreatorChanged();
+      SolutionCreator.SymbolicExpressionTreeParameter.ActualName =
+        TankProgramParameterName;
+      ParameterizeAnalyzers();
+      ParameterizeOperators();
+    }
+
+    private void ParameterizeAnalyzers() {
+      var analyzers = Operators.OfType<IAnalyzer>();
+      foreach (var o in analyzers.OfType<ISymbolicExpressionTreeAnalyzer>()) {
+        o.SymbolicExpressionTreeParameter.ActualName =
+          SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+      }
+      foreach (var o in analyzers.OfType<BestSolutionAnalyzer>()) {
+        o.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
+      }
+    }
+
+    private void ParameterizeOperators() {
+      var operators = Parameters
+        .OfType<IValueParameter>()
+        .Select(p => p.Value)
+        .OfType<IOperator>()
+        .Union(Operators);
+      foreach (var o in operators.OfType<ISymbolicExpressionTreeGrammarBasedOperator>()) {
+        o.SymbolicExpressionTreeGrammarParameter.ActualName =
+          TankGrammarParameterName;
+      }
+      foreach (var o in operators.OfType<ISymbolicExpressionTreeSizeConstraintOperator>()) {
+        o.MaximumSymbolicExpressionTreeDepthParameter.ActualName =
+          MaxTankProgramDepthParameterName;
+        o.MaximumSymbolicExpressionTreeLengthParameter.ActualName =
+          MaxTankProgramLengthParameterName;
+      }
+      foreach (var op in operators.OfType<RobocodeEvaluator>()) {
+        op.TankProgramParameter.ActualName =
+          SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+      }
+      foreach (var op in operators.OfType<ISymbolicExpressionTreeCrossover>()) {
+        op.ParentsParameter.ActualName =
+          SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+        op.ChildParameter.ActualName =
+          SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+      }
+      foreach (var op in operators.OfType<ISymbolicExpressionTreeManipulator>()) {
+        op.SymbolicExpressionTreeParameter.ActualName =
+          SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+      }
+      foreach (var op in operators.OfType<ISymbolicExpressionTreeCreator>()) {
+        op.SymbolicExpressionTreeParameter.ActualName =
+          SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
+      }
+    }
+  }
+}
Index: /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Solution.cs
===================================================================
--- /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Solution.cs	(revision 9878)
+++ /branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Solution.cs	(revision 9879)
@@ -28,18 +28,4 @@
   [StorableClass]
   public sealed class Solution : NamedItem {
-    //private int moves;
-    //[Storable]
-    //public int Moves
-    //{
-    //    get { return moves; }
-    //    private set { this.moves = value; }
-    //}
-    //private int shots;
-    //[Storable]
-    //public int Shots
-    //{
-    //    get { return shots; }
-    //    private set { this.shots = value; }
-    //}
     [Storable]
     public ISymbolicExpressionTree Tree { get; set; }
@@ -52,15 +38,12 @@
     private Solution(Solution original, Cloner cloner)
       : base(original, cloner) {
-
       Tree = cloner.Clone(original.Tree);
       Path = original.Path;
     }
 
-    public Solution(ISymbolicExpressionTree tree, string path)// int moves, int shots)
-      : base("Solution", "A tank program.") {
+    public Solution(ISymbolicExpressionTree tree, string path)
+      : base("Solution", "A Robocode program.") {
       this.Tree = tree;
       this.Path = path;
-      //this.moves = moves;
-      //this.shots = shots;
     }
 
