Changeset 10046 for branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods
- Timestamp:
- 10/17/13 12:07:20 (11 years ago)
- Location:
- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/Ahead.cs
r10014 r10046 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 52 54 53 55 public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) { 54 var enumerator = children.GetEnumerator();55 if (!enumerator.MoveNext()) throw new System.Exception("Ahead was not given a child.");56 if (children.Count() != 1) 57 throw new ArgumentException("Expected 1 child in Ahead.", "children"); 56 58 57 var symbol = enumerator.Current.Symbol; 59 var exprTree = children.Single(); 60 var symbol = exprTree.Symbol; 58 61 if (!(symbol is NumericalExpression)) 59 throw new System.Exception("Ahead was given a child of type " + symbol.GetType() +62 throw new Exception("Ahead was given a child of type " + symbol.GetType() + 60 63 ". The expected child must be of type " + typeof(NumericalExpression) + "."); 61 64 62 string result = ((CodeNode)symbol).Interpret(enumerator.Current, enumerator.Current.Subtrees); 63 if (enumerator.MoveNext()) throw new System.Exception("Ahead was given more than one child."); 64 65 string result = ((CodeNode)symbol).Interpret(exprTree, exprTree.Subtrees); 65 66 return Prefix + result + Suffix; 66 67 } -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/Back.cs
r10014 r10046 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 52 54 53 55 public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) { 54 var enumerator = children.GetEnumerator();55 if (!enumerator.MoveNext()) throw new System.Exception("Back was not given a child.");56 if (children.Count() != 1) 57 throw new ArgumentException("Expected 1 child in Back.", "children"); 56 58 57 var symbol = enumerator.Current.Symbol; 59 var exprTree = children.Single(); 60 var symbol = exprTree.Symbol; 58 61 if (!(symbol is NumericalExpression)) 59 throw new System.Exception("Back was given a child of type " + symbol.GetType() +62 throw new Exception("Back was given a child of type " + symbol.GetType() + 60 63 ". The expected child must be of type " + typeof(NumericalExpression) + "."); 61 64 62 string result = ((CodeNode)symbol).Interpret(enumerator.Current, enumerator.Current.Subtrees); 63 if (enumerator.MoveNext()) throw new System.Exception("Back was given more than one child."); 64 65 string result = ((CodeNode)symbol).Interpret(exprTree, exprTree.Subtrees); 65 66 return Prefix + result + Suffix; 66 67 } -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/Fire.cs
r10014 r10046 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 52 54 53 55 public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) { 54 var enumerator = children.GetEnumerator();55 if (!enumerator.MoveNext()) throw new System.Exception("Fire was not given a child.");56 if (children.Count() != 1) 57 throw new ArgumentException("Expected 1 child in Fire.", "children"); 56 58 57 var symbol = enumerator.Current.Symbol; 59 var exprTree = children.Single(); 60 var symbol = exprTree.Symbol; 58 61 if (!(symbol is ShotPower)) 59 throw new System.Exception("Fire was given a child of type " + symbol.GetType() +62 throw new Exception("Fire was given a child of type " + symbol.GetType() + 60 63 ". The expected child must be of type " + typeof(ShotPower) + "."); 61 64 62 string result = ((CodeNode)symbol).Interpret(enumerator.Current, enumerator.Current.Subtrees); 63 if (enumerator.MoveNext()) throw new System.Exception("Fire was given more than one child."); 64 65 string result = ((CodeNode)symbol).Interpret(exprTree, exprTree.Subtrees); 65 66 return Prefix + result + Suffix; 66 67 } -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnGunLeft.cs
r10014 r10046 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 52 54 53 55 public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) { 54 var enumerator = children.GetEnumerator();55 if (!enumerator.MoveNext()) throw new System.Exception("TurnGunLeft was not given a child.");56 if (children.Count() != 1) 57 throw new ArgumentException("Expected 1 child in TurnGunLeft.", "children"); 56 58 57 var symbol = enumerator.Current.Symbol; 59 var exprTree = children.Single(); 60 var symbol = exprTree.Symbol; 58 61 if (!(symbol is NumericalExpression)) 59 throw new System.Exception("TurnGunLeft was given a child of type " + symbol.GetType() +62 throw new Exception("TurnGunLeft was given a child of type " + symbol.GetType() + 60 63 ". The expected child must be of type " + typeof(NumericalExpression) + "."); 61 64 62 string result = ((CodeNode)symbol).Interpret(enumerator.Current, enumerator.Current.Subtrees); 63 if (enumerator.MoveNext()) throw new System.Exception("TurnGunLeft was given more than one child."); 64 65 string result = ((CodeNode)symbol).Interpret(exprTree, exprTree.Subtrees); 65 66 return Prefix + result + Suffix; 66 67 } -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnGunRight.cs
r10014 r10046 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 52 54 53 55 public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) { 54 var enumerator = children.GetEnumerator();55 if (!enumerator.MoveNext()) throw new System.Exception("TurnGunRight was not given a child.");56 if (children.Count() != 1) 57 throw new ArgumentException("Expected 1 child in TurnGunRight.", "children"); 56 58 57 var symbol = enumerator.Current.Symbol; 59 var exprTree = children.Single(); 60 var symbol = exprTree.Symbol; 58 61 if (!(symbol is NumericalExpression)) 59 throw new System.Exception("TurnGunRight was given a child of type " + symbol.GetType() +62 throw new Exception("TurnGunRight was given a child of type " + symbol.GetType() + 60 63 ". The expected child must be of type " + typeof(NumericalExpression) + "."); 61 64 62 string result = ((CodeNode)symbol).Interpret(enumerator.Current, enumerator.Current.Subtrees); 63 if (enumerator.MoveNext()) throw new System.Exception("TurnGunRight was given more than one child."); 64 65 string result = ((CodeNode)symbol).Interpret(exprTree, exprTree.Subtrees); 65 66 return Prefix + result + Suffix; 66 67 } -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnLeft.cs
r10014 r10046 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 52 54 53 55 public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) { 54 var enumerator = children.GetEnumerator();55 if (!enumerator.MoveNext()) throw new System.Exception("TurnLeft was not given a child.");56 if (children.Count() != 1) 57 throw new ArgumentException("Expected 1 child in TurnLeft.", "children"); 56 58 57 var symbol = enumerator.Current.Symbol; 59 var exprTree = children.Single(); 60 var symbol = exprTree.Symbol; 58 61 if (!(symbol is NumericalExpression)) 59 62 throw new System.Exception("TurnLeft was given a child of type " + symbol.GetType() + 60 63 ". The expected child must be of type " + typeof(NumericalExpression) + "."); 61 64 62 string result = ((CodeNode)symbol).Interpret(enumerator.Current, enumerator.Current.Subtrees); 63 if (enumerator.MoveNext()) throw new System.Exception("TurnLeft was given more than one child."); 64 65 string result = ((CodeNode)symbol).Interpret(exprTree, exprTree.Subtrees); 65 66 return Prefix + result + Suffix; 66 67 } -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnRadarLeft.cs
r10014 r10046 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 52 54 53 55 public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) { 54 var enumerator = children.GetEnumerator();55 if (!enumerator.MoveNext()) throw new System.Exception("TurnRadarLeft was not given a child.");56 if (children.Count() != 1) 57 throw new ArgumentException("Expected 1 child in TurnRadarLeft.", "children"); 56 58 57 var symbol = enumerator.Current.Symbol; 59 var exprTree = children.Single(); 60 var symbol = exprTree.Symbol; 58 61 if (!(symbol is NumericalExpression)) 59 throw new System.Exception("TurnRadarLeft was given a child of type " + symbol.GetType() +62 throw new Exception("TurnRadarLeft was given a child of type " + symbol.GetType() + 60 63 ". The expected child must be of type " + typeof(NumericalExpression) + "."); 61 64 62 string result = ((CodeNode)symbol).Interpret(enumerator.Current, enumerator.Current.Subtrees); 63 if (enumerator.MoveNext()) throw new System.Exception("TurnRadarLeft was given more than one child."); 64 65 string result = ((CodeNode)symbol).Interpret(exprTree, exprTree.Subtrees); 65 66 return Prefix + result + Suffix; 66 67 } -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnRadarRight.cs
r10014 r10046 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 52 54 53 55 public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) { 54 var enumerator = children.GetEnumerator();55 if (!enumerator.MoveNext()) throw new System.Exception("TurnRadarRight was not given a child.");56 if (children.Count() != 1) 57 throw new ArgumentException("Expected 1 child in TurnRadarRight.", "children"); 56 58 57 var symbol = enumerator.Current.Symbol; 59 var exprTree = children.Single(); 60 var symbol = exprTree.Symbol; 58 61 if (!(symbol is NumericalExpression)) 59 throw new System.Exception("TurnRadarRight was given a child of type " + symbol.GetType() +62 throw new Exception("TurnRadarRight was given a child of type " + symbol.GetType() + 60 63 ". The expected child must be of type " + typeof(NumericalExpression) + "."); 61 64 62 string result = ((CodeNode)symbol).Interpret(enumerator.Current, enumerator.Current.Subtrees); 63 if (enumerator.MoveNext()) throw new System.Exception("TurnRadarRight was given more than one child."); 64 65 string result = ((CodeNode)symbol).Interpret(exprTree, exprTree.Subtrees); 65 66 return Prefix + result + Suffix; 66 67 } -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/Symbols/Void Methods/TurnRight.cs
r10014 r10046 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 52 54 53 55 public override string Interpret(ISymbolicExpressionTreeNode node, IEnumerable<ISymbolicExpressionTreeNode> children) { 54 var enumerator = children.GetEnumerator();55 if (!enumerator.MoveNext()) throw new System.Exception("TurnRight was not given a child.");56 if (children.Count() != 1) 57 throw new ArgumentException("Expected 1 child in TurnRight.", "children"); 56 58 57 var symbol = enumerator.Current.Symbol; 59 var exprTree = children.Single(); 60 var symbol = exprTree.Symbol; 58 61 if (!(symbol is NumericalExpression)) 59 62 throw new System.Exception("TurnRight was given a child of type " + symbol.GetType() + 60 63 ". The expected child must be of type " + typeof(NumericalExpression) + "."); 61 64 62 string result = ((CodeNode)symbol).Interpret(enumerator.Current, enumerator.Current.Subtrees); 63 if (enumerator.MoveNext()) throw new System.Exception("TurnRight was given more than one child."); 64 65 string result = ((CodeNode)symbol).Interpret(exprTree, exprTree.Subtrees); 65 66 return Prefix + result + Suffix; 66 67 }
Note: See TracChangeset
for help on using the changeset viewer.