Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Robocode/HeuristicLab.Problems.Robocode/Symbols/Abandoned/ConstantTreeNode.cs @ 12394

Last change on this file since 12394 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 ConstantTreeNode : 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 ConstantTreeNode(bool deserializing) : base(deserializing) { }
22        private ConstantTreeNode(ConstantTreeNode original, Cloner cloner)
23            : base(original, cloner)
24        {
25            this.value = original.value;
26        }
27
28        public ConstantTreeNode()
29            : base(new Constant())
30        {
31        }
32
33        public override IDeepCloneable Clone(Cloner cloner)
34        {
35            return new ConstantTreeNode(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.