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 BooleanTreeNode : SymbolicExpressionTreeTerminalNode { private bool value; [Storable] public bool Value { get { return value; } private set { this.value = value; } } [StorableConstructor] private BooleanTreeNode(bool deserializing) : base(deserializing) { } private BooleanTreeNode(BooleanTreeNode original, Cloner cloner) : base(original, cloner) { this.value = original.value; } public BooleanTreeNode() : base(new LogicalValue()) { } public override IDeepCloneable Clone(Cloner cloner) { return new BooleanTreeNode(this, cloner); } public override bool HasLocalParameters { get { return true; } } public override void ResetLocalParameters(IRandom random) { value = (bool)(random.Next(0, 1) == 1); } } }