Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Logical Expressions/BooleanTreeNode.cs @ 10216

Last change on this file since 10216 was 9565, checked in by melkaref, 12 years ago

Robocode Plugin code without Mutation Operators

File size: 1.3 KB
RevLine 
[9565]1using System;
2using HeuristicLab.Common;
3using HeuristicLab.Core;
4using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
5using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
6
7namespace HeuristicLab.Problems.Robocode
8{
9    [StorableClass]
10    public class BooleanTreeNode : SymbolicExpressionTreeTerminalNode
11    {
12        private bool value;
13        [Storable]
14        public bool Value
15        {
16            get { return value; }
17            private set { this.value = value; }
18        }
19
20        [StorableConstructor]
21        private BooleanTreeNode(bool deserializing) : base(deserializing) { }
22        private BooleanTreeNode(BooleanTreeNode original, Cloner cloner)
23            : base(original, cloner)
24        {
25            this.value = original.value;
26        }
27
28        public BooleanTreeNode()
29            : base(new LogicalValue())
30        {
31        }
32
33        public override IDeepCloneable Clone(Cloner cloner)
34        {
35            return new BooleanTreeNode(this, cloner);
36        }
37
38        public override bool HasLocalParameters
39        {
40            get { return true; }
41        }
42
43        public override void ResetLocalParameters(IRandom random)
44        {
45            value = (bool)(random.Next(0, 1) == 1);
46        }
47    }
48}
Note: See TracBrowser for help on using the repository browser.