using HeuristicLab.Common; using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.Problems.Robocode { [StorableClass] public class Tank : CodeNode { public override int MinimumArity { get { return 7; } } public override int MaximumArity { get { return 7; } } [Storable] public override string Prefix { get; set; } [Storable] public override string Suffix { get; set; } [StorableConstructor] private Tank(bool deserializing) : base(deserializing) { } private Tank(Tank original, Cloner cloner) : base(original, cloner) { } public Tank() : base("Tank", "The root of a Robocode Tank program.") { this.Prefix = "package Evaluation;" + "\r\nimport robocode.*;" + "\r\nimport robocode.Robot;" + "\r\nimport robocode.util.*;" + "\r\nimport static robocode.util.Utils.normalRelativeAngleDegrees;" + "\r\nimport java.awt.*;" + "\r\n\r\n" + "\r\npublic class output extends AdvancedRobot {\r\n"; this.Suffix = "\r\n}"; } public override IDeepCloneable Clone(Cloner cloner) { return new Tank(this, cloner); } public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable children) { string result = ""; foreach (ISymbolicExpressionTreeNode c in children) result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; } } }