- Timestamp:
- 06/14/13 11:03:13 (11 years ago)
- Location:
- branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Event Methods
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Event Methods/Events/EmptyEvent.cs
r9612 r9630 19 19 private EmptyEvent(EmptyEvent original, Cloner cloner) 20 20 : base(original, cloner) { 21 this.Prefix = "";22 this.Suffix = "";23 21 } 24 22 -
branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Event Methods/Events/OnBulletHit.cs
r9565 r9630 3 3 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 4 4 5 namespace HeuristicLab.Problems.Robocode 6 { 7 [StorableClass] 8 public class OnBulletHit : CodeNode 9 { 10 public override int MinimumArity { get { return 2; } } 11 public override int MaximumArity { get { return 10; } } 5 namespace HeuristicLab.Problems.Robocode { 6 [StorableClass] 7 public class OnBulletHit : CodeNode { 8 public override int MinimumArity { get { return 2; } } 9 public override int MaximumArity { get { return 10; } } 12 10 13 14 11 [Storable] 12 public override string Prefix { get; set; } 15 13 16 17 14 [Storable] 15 public override string Suffix { get; set; } 18 16 19 [StorableConstructor] 20 private OnBulletHit(bool deserializing) : base(deserializing) { } 21 private OnBulletHit(OnBulletHit original, Cloner cloner) 22 : base(original, cloner) 23 { 24 this.Prefix = "\r\npublic void onBulletHit(BulletHitEvent e) {\r\n"; 25 this.Suffix = "\r\nexecute();\r\n}\r\n"; 26 } 17 [StorableConstructor] 18 private OnBulletHit(bool deserializing) : base(deserializing) { } 19 private OnBulletHit(OnBulletHit original, Cloner cloner) 20 : base(original, cloner) { 27 21 28 public OnBulletHit() 29 : base("OnBulletHit", "This method is called when one of your bullets hits another robot.") 30 { 31 this.Prefix = "\r\npublic void onBulletHit(BulletHitEvent e) {\r\n"; 32 this.Suffix = "\r\nexecute();\r\n}\r\n"; 33 } 22 } 34 23 35 public override IDeepCloneable Clone(Cloner cloner) 36 { 37 return new OnBulletHit(this, cloner); 38 } 24 public OnBulletHit() 25 : base("OnBulletHit", "This method is called when one of your bullets hits another robot.") { 26 this.Prefix = "\r\npublic void onBulletHit(BulletHitEvent e) {\r\n"; 27 this.Suffix = "\r\nexecute();\r\n}\r\n"; 28 } 39 29 40 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) 41 { 42 string result = ""; 43 foreach (ISymbolicExpressionTreeNode c in children) 44 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 45 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 46 } 30 public override IDeepCloneable Clone(Cloner cloner) { 31 return new OnBulletHit(this, cloner); 47 32 } 33 34 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) { 35 string result = ""; 36 foreach (ISymbolicExpressionTreeNode c in children) 37 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 38 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 39 } 40 } 48 41 } -
branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Event Methods/Events/OnBulletMissed.cs
r9565 r9630 3 3 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 4 4 5 namespace HeuristicLab.Problems.Robocode 6 { 7 [StorableClass] 8 public class OnBulletMissed : CodeNode 9 { 10 public override int MinimumArity { get { return 2; } } 11 public override int MaximumArity { get { return 10; } } 5 namespace HeuristicLab.Problems.Robocode { 6 [StorableClass] 7 public class OnBulletMissed : CodeNode { 8 public override int MinimumArity { get { return 2; } } 9 public override int MaximumArity { get { return 10; } } 12 10 13 14 11 [Storable] 12 public override string Prefix { get; set; } 15 13 16 17 14 [Storable] 15 public override string Suffix { get; set; } 18 16 19 [StorableConstructor] 20 private OnBulletMissed(bool deserializing) : base(deserializing) { } 21 private OnBulletMissed(OnBulletMissed original, Cloner cloner) 22 : base(original, cloner) 23 { 24 this.Prefix = "\r\npublic void onBulletMissed(BulletMissedEvent e) {\r\n"; 25 this.Suffix = "\r\nexecute();\r\n}\r\n"; 26 } 17 [StorableConstructor] 18 private OnBulletMissed(bool deserializing) : base(deserializing) { } 19 private OnBulletMissed(OnBulletMissed original, Cloner cloner) 20 : base(original, cloner) { 27 21 28 public OnBulletMissed() 29 : base("OnBulletMissed", "This method is called when one of your bullets misses, i.e. hits a wall.") 30 { 31 this.Prefix = "\r\npublic void onBulletMissed(BulletMissedEvent e) {\r\n"; 32 this.Suffix = "\r\nexecute();\r\n}\r\n"; 33 } 22 } 34 23 35 public override IDeepCloneable Clone(Cloner cloner) 36 { 37 return new OnBulletMissed(this, cloner); 38 } 24 public OnBulletMissed() 25 : base("OnBulletMissed", "This method is called when one of your bullets misses, i.e. hits a wall.") { 26 this.Prefix = "\r\npublic void onBulletMissed(BulletMissedEvent e) {\r\n"; 27 this.Suffix = "\r\nexecute();\r\n}\r\n"; 28 } 39 29 40 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) 41 { 42 string result = ""; 43 foreach (ISymbolicExpressionTreeNode c in children) 44 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 45 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 46 } 30 public override IDeepCloneable Clone(Cloner cloner) { 31 return new OnBulletMissed(this, cloner); 47 32 } 33 34 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) { 35 string result = ""; 36 foreach (ISymbolicExpressionTreeNode c in children) 37 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 38 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 39 } 40 } 48 41 } -
branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Event Methods/Events/OnHitByBullet.cs
r9565 r9630 3 3 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 4 4 5 namespace HeuristicLab.Problems.Robocode 6 { 7 [StorableClass] 8 public class OnHitByBullet : CodeNode 9 { 10 public override int MinimumArity { get { return 2; } } 11 public override int MaximumArity { get { return 10; } } 5 namespace HeuristicLab.Problems.Robocode { 6 [StorableClass] 7 public class OnHitByBullet : CodeNode { 8 public override int MinimumArity { get { return 2; } } 9 public override int MaximumArity { get { return 10; } } 12 10 13 14 11 [Storable] 12 public override string Prefix { get; set; } 15 13 16 17 14 [Storable] 15 public override string Suffix { get; set; } 18 16 19 [StorableConstructor] 20 private OnHitByBullet(bool deserializing) : base(deserializing) { } 21 private OnHitByBullet(OnHitByBullet original, Cloner cloner) 22 : base(original, cloner) 23 { 24 this.Prefix = "\r\npublic void onHitByBullet(HitByBulletEvent e) {\r\n"; 25 this.Suffix = "\r\nexecute();\r\n}\r\n"; 26 } 17 [StorableConstructor] 18 private OnHitByBullet(bool deserializing) : base(deserializing) { } 19 private OnHitByBullet(OnHitByBullet original, Cloner cloner) 20 : base(original, cloner) { 27 21 28 public OnHitByBullet() 29 : base("OnHitByBullet", "This method is called when your robot is hit by a bullet.") 30 { 31 this.Prefix = "\r\npublic void onHitByBullet(HitByBulletEvent e) {\r\n"; 32 this.Suffix = "\r\nexecute();\r\n}\r\n"; 33 } 22 } 34 23 35 public override IDeepCloneable Clone(Cloner cloner) 36 { 37 return new OnHitByBullet(this, cloner); 38 } 24 public OnHitByBullet() 25 : base("OnHitByBullet", "This method is called when your robot is hit by a bullet.") { 26 this.Prefix = "\r\npublic void onHitByBullet(HitByBulletEvent e) {\r\n"; 27 this.Suffix = "\r\nexecute();\r\n}\r\n"; 28 } 39 29 40 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) 41 { 42 string result = ""; 43 foreach (ISymbolicExpressionTreeNode c in children) 44 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 45 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 46 } 30 public override IDeepCloneable Clone(Cloner cloner) { 31 return new OnHitByBullet(this, cloner); 47 32 } 33 34 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) { 35 string result = ""; 36 foreach (ISymbolicExpressionTreeNode c in children) 37 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 38 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 39 } 40 } 48 41 } -
branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Event Methods/Events/OnHitRobot.cs
r9565 r9630 3 3 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 4 4 5 namespace HeuristicLab.Problems.Robocode 6 { 7 [StorableClass] 8 public class OnHitRobot : CodeNode 9 { 10 public override int MinimumArity { get { return 2; } } 11 public override int MaximumArity { get { return 10; } } 5 namespace HeuristicLab.Problems.Robocode { 6 [StorableClass] 7 public class OnHitRobot : CodeNode { 8 public override int MinimumArity { get { return 2; } } 9 public override int MaximumArity { get { return 10; } } 12 10 13 14 11 [Storable] 12 public override string Prefix { get; set; } 15 13 16 17 14 [Storable] 15 public override string Suffix { get; set; } 18 16 19 [StorableConstructor] 20 private OnHitRobot(bool deserializing) : base(deserializing) { } 21 private OnHitRobot(OnHitRobot original, Cloner cloner) 22 : base(original, cloner) 23 { 24 this.Prefix = "\r\npublic void onHitRobot(HitRobotEvent e) {\r\n"; 25 this.Suffix = "\r\nexecute();\r\n}\r\n"; 26 } 17 [StorableConstructor] 18 private OnHitRobot(bool deserializing) : base(deserializing) { } 19 private OnHitRobot(OnHitRobot original, Cloner cloner) 20 : base(original, cloner) { 21 } 27 22 28 public OnHitRobot() 29 : base("OnHitRobot", "This method is called when your robot collides with another robot.") 30 { 31 this.Prefix = "\r\npublic void onHitRobot(HitRobotEvent e) {\r\n"; 32 this.Suffix = "\r\nexecute();\r\n}\r\n"; 33 } 23 public OnHitRobot() 24 : base("OnHitRobot", "This method is called when your robot collides with another robot.") { 25 this.Prefix = "\r\npublic void onHitRobot(HitRobotEvent e) {\r\n"; 26 this.Suffix = "\r\nexecute();\r\n}\r\n"; 27 } 34 28 35 public override IDeepCloneable Clone(Cloner cloner) 36 { 37 return new OnHitRobot(this, cloner); 38 } 29 public override IDeepCloneable Clone(Cloner cloner) { 30 return new OnHitRobot(this, cloner); 31 } 39 32 40 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) 41 { 42 string result = ""; 43 foreach (ISymbolicExpressionTreeNode c in children) 44 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 45 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 46 } 33 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) { 34 string result = ""; 35 foreach (ISymbolicExpressionTreeNode c in children) 36 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 37 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 47 38 } 39 } 48 40 } -
branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Event Methods/Events/OnHitWall.cs
r9565 r9630 3 3 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 4 4 5 namespace HeuristicLab.Problems.Robocode 6 { 7 [StorableClass] 8 public class OnHitWall : CodeNode 9 { 10 public override int MinimumArity { get { return 2; } } 11 public override int MaximumArity { get { return 10; } } 5 namespace HeuristicLab.Problems.Robocode { 6 [StorableClass] 7 public class OnHitWall : CodeNode { 8 public override int MinimumArity { get { return 2; } } 9 public override int MaximumArity { get { return 10; } } 12 10 13 14 11 [Storable] 12 public override string Prefix { get; set; } 15 13 16 17 14 [Storable] 15 public override string Suffix { get; set; } 18 16 19 [StorableConstructor] 20 private OnHitWall(bool deserializing) : base(deserializing) { } 21 private OnHitWall(OnHitWall original, Cloner cloner) 22 : base(original, cloner) 23 { 24 this.Prefix = "\r\npublic void onHitWall(HitWallEvent e) {\r\n"; 25 this.Suffix = "\r\nexecute();\r\n}\r\n"; 26 } 17 [StorableConstructor] 18 private OnHitWall(bool deserializing) : base(deserializing) { } 19 private OnHitWall(OnHitWall original, Cloner cloner) 20 : base(original, cloner) { 27 21 28 public OnHitWall() 29 : base("OnHitWall", "This method is called when your robot collides with a wall.") 30 { 31 this.Prefix = "\r\npublic void onHitWall(HitWallEvent e) {\r\n"; 32 this.Suffix = "\r\nexecute();\r\n}\r\n"; 33 } 22 } 34 23 35 public override IDeepCloneable Clone(Cloner cloner) 36 { 37 return new OnHitWall(this, cloner); 38 } 24 public OnHitWall() 25 : base("OnHitWall", "This method is called when your robot collides with a wall.") { 26 this.Prefix = "\r\npublic void onHitWall(HitWallEvent e) {\r\n"; 27 this.Suffix = "\r\nexecute();\r\n}\r\n"; 28 } 39 29 40 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) 41 { 42 string result = ""; 43 foreach (ISymbolicExpressionTreeNode c in children) 44 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 45 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 46 } 30 public override IDeepCloneable Clone(Cloner cloner) { 31 return new OnHitWall(this, cloner); 47 32 } 33 34 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) { 35 string result = ""; 36 foreach (ISymbolicExpressionTreeNode c in children) 37 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 38 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 39 } 40 } 48 41 } -
branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Event Methods/Events/OnScannedRobot.cs
r9565 r9630 3 3 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 4 4 5 namespace HeuristicLab.Problems.Robocode 6 { 7 [StorableClass] 8 public class OnScannedRobot : CodeNode 9 { 10 public override int MinimumArity { get { return 2; } } 11 public override int MaximumArity { get { return 10; } } 5 namespace HeuristicLab.Problems.Robocode { 6 [StorableClass] 7 public class OnScannedRobot : CodeNode { 8 public override int MinimumArity { get { return 2; } } 9 public override int MaximumArity { get { return 10; } } 12 10 13 14 11 [Storable] 12 public override string Prefix { get; set; } 15 13 16 17 14 [Storable] 15 public override string Suffix { get; set; } 18 16 19 [StorableConstructor] 20 private OnScannedRobot(bool deserializing) : base(deserializing) { } 21 private OnScannedRobot(OnScannedRobot original, Cloner cloner) 22 : base(original, cloner) 23 { 24 this.Prefix = "\r\npublic void onScannedRobot(ScannedRobotEvent e) {" + 25 "\r\ndouble absoluteBearing = getHeading() + e.getBearing();" + 26 "\r\ndouble bearingFromGun = normalRelativeAngleDegrees(absoluteBearing - getGunHeading());" + 27 "\r\nsetTurnGunRight(bearingFromGun);\r\n"; 28 this.Suffix = "\r\nexecute();\r\n}\r\n"; 29 } 17 [StorableConstructor] 18 private OnScannedRobot(bool deserializing) : base(deserializing) { } 19 private OnScannedRobot(OnScannedRobot original, Cloner cloner) 20 : base(original, cloner) { 30 21 31 public OnScannedRobot() 32 : base("OnScannedRobot", "This method is called when your robot sees another robot, i.e. when the robot's radar scan \"hits\" another robot.") 33 { 34 this.Prefix = "\r\npublic void onScannedRobot(ScannedRobotEvent e) {" + 35 "\r\ndouble absoluteBearing = getHeading() + e.getBearing();" + 36 "\r\ndouble bearingFromGun = normalRelativeAngleDegrees(absoluteBearing - getGunHeading());" + 37 "\r\nsetTurnGunRight(bearingFromGun);\r\n"; 38 this.Suffix = "\r\nexecute();\r\n}\r\n"; 39 } 22 } 40 23 41 public override IDeepCloneable Clone(Cloner cloner) 42 { 43 return new OnScannedRobot(this, cloner); 44 } 24 public OnScannedRobot() 25 : base("OnScannedRobot", "This method is called when your robot sees another robot, i.e. when the robot's radar scan \"hits\" another robot.") { 26 this.Prefix = "\r\npublic void onScannedRobot(ScannedRobotEvent e) {" + 27 "\r\ndouble absoluteBearing = getHeading() + e.getBearing();" + 28 "\r\ndouble bearingFromGun = normalRelativeAngleDegrees(absoluteBearing - getGunHeading());" + 29 "\r\nsetTurnGunRight(bearingFromGun);\r\n"; 30 this.Suffix = "\r\nexecute();\r\n}\r\n"; 31 } 45 32 46 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) 47 { 48 string result = ""; 49 foreach (ISymbolicExpressionTreeNode c in children) 50 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 51 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 52 } 33 public override IDeepCloneable Clone(Cloner cloner) { 34 return new OnScannedRobot(this, cloner); 53 35 } 36 37 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) { 38 string result = ""; 39 foreach (ISymbolicExpressionTreeNode c in children) 40 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 41 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 42 } 43 } 54 44 } -
branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Event Methods/Run.cs
r9565 r9630 3 3 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 4 4 5 namespace HeuristicLab.Problems.Robocode 6 { 7 [StorableClass] 8 public class Run : CodeNode 9 { 10 public override int MinimumArity { get { return 2; } } 11 public override int MaximumArity { get { return 10; } } 12 13 [Storable] 14 public override string Prefix { get; set; } 15 16 [Storable] 17 public override string Suffix { get; set; } 5 namespace HeuristicLab.Problems.Robocode { 6 [StorableClass] 7 public class Run : CodeNode { 8 public override int MinimumArity { get { return 2; } } 9 public override int MaximumArity { get { return 10; } } 18 10 19 [StorableConstructor] 20 private Run(bool deserializing) : base(deserializing) { } 21 private Run(Run original, Cloner cloner) 22 : base(original, cloner) 23 { 24 this.Prefix = "\r\npublic void run() {\r\n\tsetAdjustGunForRobotTurn(true);\r\n\tturnRadarRightRadians(Double.POSITIVE_INFINITY);"; 25 this.Suffix = "\r\nexecute();\r\n}\r\n"; 26 } 11 [Storable] 12 public override string Prefix { get; set; } 27 13 28 public Run() 29 : base("Run", "The main method in every robot.") 30 { 31 this.Prefix = "\r\npublic void run() {\r\n\tsetAdjustGunForRobotTurn(true);\r\n\tturnRadarRightRadians(Double.POSITIVE_INFINITY);"; 32 this.Suffix = "\r\nexecute();\r\n}\r\n"; 33 } 14 [Storable] 15 public override string Suffix { get; set; } 34 16 35 public override IDeepCloneable Clone(Cloner cloner) 36 { 37 return new Run(this, cloner); 38 } 17 [StorableConstructor] 18 private Run(bool deserializing) : base(deserializing) { } 19 private Run(Run original, Cloner cloner) 20 : base(original, cloner) { 21 } 39 22 40 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) 41 { 42 string result = ""; 43 foreach (ISymbolicExpressionTreeNode c in children) 44 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 45 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 46 } 23 public Run() 24 : base("Run", "The main method in every robot.") { 25 this.Prefix = "\r\npublic void run() {\r\n\tsetAdjustGunForRobotTurn(true);\r\n\tturnRadarRightRadians(Double.POSITIVE_INFINITY);"; 26 this.Suffix = "\r\nexecute();\r\n}\r\n"; 47 27 } 28 29 public override IDeepCloneable Clone(Cloner cloner) { 30 return new Run(this, cloner); 31 } 32 33 public override string Interpret(ISymbolicExpressionTreeNode node, System.Collections.Generic.IEnumerable<ISymbolicExpressionTreeNode> children) { 34 string result = ""; 35 foreach (ISymbolicExpressionTreeNode c in children) 36 result += "\r\n" + ((CodeNode)c.Symbol).Interpret(c, c.Subtrees); 37 return this.Prefix + "\r\n" + result + "\r\n" + this.Suffix; 38 } 39 } 48 40 }
Note: See TracChangeset
for help on using the changeset viewer.