Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Robocode/HeuristicLab.Problems.Robocode/Solution.cs @ 12448

Last change on this file since 12448 was 9601, checked in by ascheibe, 12 years ago

#2069

  • fixed cloning in Solution so that the SolutionCodeView can run a battle
  • fixed a compiler warning in CodeNodeView
File size: 1.4 KB
Line 
1using HeuristicLab.Common;
2using HeuristicLab.Core;
3using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
4using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
5
6namespace HeuristicLab.Problems.Robocode {
7  [StorableClass]
8  public sealed class Solution : NamedItem {
9    //private int moves;
10    //[Storable]
11    //public int Moves
12    //{
13    //    get { return moves; }
14    //    private set { this.moves = value; }
15    //}
16    //private int shots;
17    //[Storable]
18    //public int Shots
19    //{
20    //    get { return shots; }
21    //    private set { this.shots = value; }
22    //}
23    [Storable]
24    public ISymbolicExpressionTree Tree { get; set; }
25
26    [Storable]
27    public string Path { get; set; }
28
29    [StorableConstructor]
30    private Solution(bool deserializing) : base(deserializing) { }
31    private Solution(Solution original, Cloner cloner)
32      : base(original, cloner) {
33
34      Tree = cloner.Clone(original.Tree);
35      Path = original.Path;
36    }
37
38    public Solution(ISymbolicExpressionTree tree, string path)// int moves, int shots)
39      : base("Solution", "A tank program.") {
40      this.Tree = tree;
41      this.Path = path;
42      //this.moves = moves;
43      //this.shots = shots;
44    }
45
46    public override IDeepCloneable Clone(Cloner cloner) {
47      return new Solution(this, cloner);
48    }
49  }
50}
Note: See TracBrowser for help on using the repository browser.