Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9570


Ignore:
Timestamp:
06/03/13 15:02:05 (11 years ago)
Author:
melkaref
Message:

Fixed SolutionCodeView to use the specified Path variable

Location:
branches/Robocode/HeuristicLab.Problems.Robocode
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/Robocode/HeuristicLab.Problems.Robocode/BestSolutionAnalyzer.cs

    r9565 r9570  
    165165            //int shots = ShotsParameter.ActualValue.Value;
    166166            //int moves = MovesParameter.ActualValue.Value;
    167             var bestSolution = new Solution(bestTree, actualQuality);//, moves, shots);
     167            var bestSolution = new Solution(bestTree, RobocodePathParameter.ActualValue.Value);//, moves, shots);
    168168            // store the new solution in the best solution parameter
    169169            BestSolutionParameter.ActualValue = bestSolution;
  • branches/Robocode/HeuristicLab.Problems.Robocode/Evaluator.cs

    r9567 r9570  
    116116           
    117117            ISymbolicExpressionTree tree = TankProgramParameter.ActualValue;
    118             XmlDocument doc = new XmlDocument();
     118            //XmlDocument doc = new XmlDocument();
    119119            //doc.Load("../tank.xml");
    120             XmlNode node = doc.FirstChild.Clone();
     120            XmlNode node = null;
    121121            string path = RobocodePathParameter.ActualValue.Value;
    122122
  • branches/Robocode/HeuristicLab.Problems.Robocode/Solution.cs

    r9565 r9570  
    3131        }
    3232
    33         private double quality;
     33        private string path;
    3434        [Storable]
    35         public double Quality
     35        public string Path
    3636        {
    37             get { return quality; }
    38             private set { this.quality = value; }
     37            get { return path; }
     38            private set { this.path = value; }
    3939        }
    4040
     
    4949        }
    5050
    51         public Solution(ISymbolicExpressionTree tree, double quality)// int moves, int shots)
     51        public Solution(ISymbolicExpressionTree tree, string path)// int moves, int shots)
    5252            : base("Solution", "A tank program.")
    5353        {
    5454            this.tree = tree;
    55             this.quality = quality;
     55            this.path = path;
    5656            //this.moves = moves;
    5757            //this.shots = shots;
  • branches/Robocode/HeuristicLab.Problems.Robocode/SolutionCodeView.cs

    r9565 r9570  
    2121    public partial class SolutionCodeView : NamedItemView
    2222    {
     23        private string Path { get; set; }
     24
    2325        public new Solution Content
    2426        {
     
    3032        {
    3133            InitializeComponent();
     34            this.Path = "F:/robocode/";
    3235            this.programCode.Text = "";
    3336        }
     
    4245            else
    4346            {
     47                this.Path = Content.Path;
    4448                string code = Interpreter.InterpretProgramTree(Content.Tree.Root);
    4549                code = code.Replace("class output extends", "class BestSolution extends");
    4650                this.programCode.Text = code;
    47                 File.AppendAllText("F:/robocode/robots/Evaluation/PreviousBestSolution.java", "\r\n/**********************************************/\r\n" + code);
    48                 File.WriteAllText("F:/robocode/robots/Evaluation/BestSolution.java", code, System.Text.Encoding.Default);
     51                File.AppendAllText(Path + "/robots/Evaluation/PreviousBestSolution.java", "\r\n/**********************************************/\r\n" + code);
     52                File.WriteAllText(Path + "/robots/Evaluation/BestSolution.java", code, System.Text.Encoding.Default);
    4953            }
    5054        }
     
    5256        private void btnRunInRobocode_Click(object sender, EventArgs e)
    5357        {
     58            string formattedPath = Path.Replace("/", "\\");
    5459            ProcessStartInfo javaCompileInfo = new ProcessStartInfo();
    5560            javaCompileInfo.FileName = "cmd.exe";
    56             javaCompileInfo.Arguments = "/C javac -cp F:\\robocode\\libs\\robocode.jar F:\\robocode\\robots\\Evaluation\\BestSolution.java";
     61            javaCompileInfo.Arguments = "/C javac -cp " + formattedPath + "\\libs\\robocode.jar " + formattedPath + "\\robots\\Evaluation\\BestSolution.java";
    5762            javaCompileInfo.RedirectStandardOutput = true;
    5863            javaCompileInfo.RedirectStandardError = true;
     
    6873            evaluateCodeInfo.FileName = "cmd.exe";
    6974            //javaCompileInfo.Arguments = "/C javac -cp C:\\robocode\\libs\\robocode.jar \"" + path + "\\Spaced Up\\output.java\"";
    70             evaluateCodeInfo.Arguments = "/C java -classpath F:\\robocode\\libs;F:\\robocode\\libs\\robocode.core-1.8.1.0.jar;F:\\robocode\\libs\\robocode.jar;F:\\robocode\\libs\\picocontainer-2.14.2.jar BattleRunner Evaluation.BestSolution*";
     75            evaluateCodeInfo.Arguments = "/C java -classpath " + formattedPath + "\\libs;" + formattedPath + "\\libs\\robocode.core-1.8.1.0.jar;" + formattedPath + "\\libs\\robocode.jar;" + formattedPath + "\\libs\\picocontainer-2.14.2.jar BattleRunner Evaluation.BestSolution*";
    7176            //Console.WriteLine(javaCompileInfo.Arguments);
    7277            evaluateCodeInfo.RedirectStandardOutput = true;
Note: See TracChangeset for help on using the changeset viewer.