- Timestamp:
- 10/01/13 12:08:25 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Tank.cs
r9790 r10011 20 20 #endregion 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 28 30 [StorableClass] 29 31 public class Tank : CodeNode { 30 public override int MinimumArity { get { return 7; } }32 public override int MinimumArity { get { return 2; } } 31 33 public override int MaximumArity { get { return 7; } } 32 34 … … 38 40 39 41 [StorableConstructor] 40 private Tank(bool deserializing) : base(deserializing) { } 41 private Tank(Tank original, Cloner cloner) 42 : base(original, cloner) { 43 } 42 protected Tank(bool deserializing) : base(deserializing) { } 43 protected Tank(Tank original, Cloner cloner) : base(original, cloner) { } 44 44 45 45 public Tank() 46 46 : base("Tank", "The root of a Robocode Tank program.") { 47 this.Prefix = "package Evaluation;" + 48 "\r\nimport robocode.*;" + 49 "\r\nimport robocode.Robot;" + 50 "\r\nimport robocode.util.*;" + 51 "\r\nimport static robocode.util.Utils.normalRelativeAngleDegrees;" + 52 "\r\nimport java.awt.*;" + 53 "\r\n\r\n" + 54 "\r\npublic class output extends AdvancedRobot {\r\n"; 55 this.Suffix = "\r\n}"; 47 Prefix = 48 @"package Evaluation; 49 import robocode.*; 50 import robocode.Robot; 51 import robocode.util.*; 52 import static robocode.util.Utils.normalRelativeAngleDegrees; 53 import java.awt.*; 54 55 public class output extends AdvancedRobot {"; 56 Suffix = "}"; 56 57 } 57 58 … … 60 61 } 61 62 62 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) { 63 string result = ""; 64 foreach (ISymbolicExpressionTreeNode c in children) 65 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 66 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 63 public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) { 64 string result = children.Aggregate(string.Empty, (current, c) => current + (Environment.NewLine + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees))); 65 return Prefix + result + Environment.NewLine + Suffix; 67 66 } 68 67 }
Note: See TracChangeset
for help on using the changeset viewer.