Changeset 10011 for branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Event Methods/Events/OnBulletHit.cs
- 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/Event Methods/Events/OnBulletHit.cs
r9790 r10011 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 22 25 using HeuristicLab.Common; 23 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 37 40 38 41 [StorableConstructor] 39 private OnBulletHit(bool deserializing) : base(deserializing) { } 40 private OnBulletHit(OnBulletHit original, Cloner cloner) 41 : base(original, cloner) { 42 43 } 42 protected OnBulletHit(bool deserializing) : base(deserializing) { } 43 protected OnBulletHit(OnBulletHit original, Cloner cloner) : base(original, cloner) { } 44 44 45 45 public OnBulletHit() 46 46 : base("OnBulletHit", "This method is called when one of your bullets hits another robot.") { 47 this.Prefix = "\r\npublic void onBulletHit(BulletHitEvent e) {\r\n"; 48 this.Suffix = "\r\nexecute();\r\n}\r\n"; 47 Prefix = "public void onBulletHit(BulletHitEvent e) {"; 48 Suffix = 49 @"execute(); 50 }"; 49 51 } 50 52 … … 53 55 } 54 56 55 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) { 56 string result = ""; 57 foreach (ISymbolicExpressionTreeNode c in children) 58 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 59 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 57 public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) { 58 string result = children.Aggregate(string.Empty, (current, c) => current + (Environment.NewLine + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees))); 59 return Prefix + result + Environment.NewLine + Suffix; 60 60 } 61 61 }
Note: See TracChangeset
for help on using the changeset viewer.