Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Numerical Expressions/NumberTreeNode.cs @ 9565

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

Robocode Plugin code without Mutation Operators

File size: 1.3 KB
Line 
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 NumberTreeNode : SymbolicExpressionTreeTerminalNode
11    {
12        private int value;
13        [Storable]
14        public int Value
15        {
16            get { return value; }
17            private set { this.value = value; }
18        }
19
20        [StorableConstructor]
21        private NumberTreeNode(bool deserializing) : base(deserializing) { }
22        private NumberTreeNode(NumberTreeNode original, Cloner cloner)
23            : base(original, cloner)
24        {
25            this.value = original.value;
26        }
27
28        public NumberTreeNode()
29            : base(new Number())
30        {
31        }
32
33        public override IDeepCloneable Clone(Cloner cloner)
34        {
35            return new NumberTreeNode(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 = random.Next(-360, 360);
46        }
47    }
48}
Note: See TracBrowser for help on using the repository browser.