using System; using HeuristicLab.Common; using HeuristicLab.Core; using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; namespace HeuristicLab.Problems.Robocode { [StorableClass] public class ConstantTreeNode : SymbolicExpressionTreeTerminalNode { private int value; [Storable] public int Value { get { return value; } private set { this.value = value; } } [StorableConstructor] private ConstantTreeNode(bool deserializing) : base(deserializing) { } private ConstantTreeNode(ConstantTreeNode original, Cloner cloner) : base(original, cloner) { this.value = original.value; } public ConstantTreeNode() : base(new Constant()) { } public override IDeepCloneable Clone(Cloner cloner) { return new ConstantTreeNode(this, cloner); } public override bool HasLocalParameters { get { return true; } } public override void ResetLocalParameters(IRandom random) { value = random.Next(-360, 360); } } }