- Timestamp:
- 07/26/13 15:13:05 (11 years ago)
- Location:
- branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/CodeNodeView.cs
r9781 r9790 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Windows.Forms; 3 24 using HeuristicLab.Core.Views; -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/Plugin.cs.frame
r9787 r9790 29 29 namespace HeuristicLab.Problems.Robocode.Views 30 30 { 31 [Plugin("HeuristicLab.Problems.Robocode.Views", "The Robocode problem for genetic programming.", "3.3. 7.$WCREV$")]31 [Plugin("HeuristicLab.Problems.Robocode.Views", "The Robocode problem for genetic programming.", "3.3.8.$WCREV$")] 32 32 [PluginFile("HeuristicLab.Problems.Robocode.Views-3.3.dll", PluginFileType.Assembly)] 33 33 [PluginDependency("HeuristicLab.Data", "3.3")] -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/SolutionCodeView.cs
r9781 r9790 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Drawing; 5 using System.Data; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 23 using System.Diagnostics; 24 using System.IO; 9 25 using System.Windows.Forms; 10 26 using HeuristicLab.Core.Views; 11 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;12 27 using HeuristicLab.MainForm; 13 using System.Diagnostics;14 using System.IO;15 28 16 29 17 namespace HeuristicLab.Problems.Robocode 18 { 19 [View("Robocode Tank Code View")] 20 [Content(typeof(Solution), IsDefaultView = true)] 21 public partial class SolutionCodeView : NamedItemView 22 { 23 private string Path { get; set; } 30 namespace HeuristicLab.Problems.Robocode { 31 [View("Robocode Tank Code View")] 32 [Content(typeof(Solution), IsDefaultView = true)] 33 public partial class SolutionCodeView : NamedItemView { 34 private string Path { get; set; } 24 35 25 public new Solution Content 26 { 27 get { return (Solution)base.Content; } 28 set { base.Content = value; } 29 } 36 public new Solution Content { 37 get { return (Solution)base.Content; } 38 set { base.Content = value; } 39 } 30 40 31 public SolutionCodeView() : base()32 33 34 35 36 41 public SolutionCodeView() 42 : base() { 43 InitializeComponent(); 44 this.Path = "F:/robocode/"; 45 this.programCode.Text = ""; 46 } 37 47 38 protected override void OnContentChanged() 39 { 40 base.OnContentChanged(); 41 if (Content == null) 42 { 43 this.programCode.Text = ""; 44 } 45 else 46 { 47 this.Path = Content.Path; 48 string code = Interpreter.InterpretProgramTree(Content.Tree.Root); 49 code = code.Replace("class output extends", "class BestSolution extends"); 50 this.programCode.Text = code; 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); 53 } 54 } 48 protected override void OnContentChanged() { 49 base.OnContentChanged(); 50 if (Content == null) { 51 this.programCode.Text = ""; 52 } else { 53 this.Path = Content.Path; 54 string code = Interpreter.InterpretProgramTree(Content.Tree.Root); 55 code = code.Replace("class output extends", "class BestSolution extends"); 56 this.programCode.Text = code; 57 File.AppendAllText(Path + "/robots/Evaluation/PreviousBestSolution.java", "\r\n/**********************************************/\r\n" + code); 58 File.WriteAllText(Path + "/robots/Evaluation/BestSolution.java", code, System.Text.Encoding.Default); 59 } 60 } 55 61 56 private void btnRunInRobocode_Click(object sender, EventArgs e) 57 { 58 string formattedPath = Path.Replace("/", "\\"); 59 ProcessStartInfo javaCompileInfo = new ProcessStartInfo(); 60 javaCompileInfo.FileName = "cmd.exe"; 61 javaCompileInfo.Arguments = "/C javac -cp " + formattedPath + "\\libs\\robocode.jar " + formattedPath + "\\robots\\Evaluation\\BestSolution.java"; 62 javaCompileInfo.RedirectStandardOutput = true; 63 javaCompileInfo.RedirectStandardError = true; 64 javaCompileInfo.UseShellExecute = false; 65 javaCompileInfo.CreateNoWindow = true; 62 private void btnRunInRobocode_Click(object sender, EventArgs e) { 63 string formattedPath = Path.Replace("/", "\\"); 64 ProcessStartInfo javaCompileInfo = new ProcessStartInfo(); 65 javaCompileInfo.FileName = "cmd.exe"; 66 javaCompileInfo.Arguments = "/C javac -cp " + formattedPath + "\\libs\\robocode.jar " + formattedPath + "\\robots\\Evaluation\\BestSolution.java"; 67 javaCompileInfo.RedirectStandardOutput = true; 68 javaCompileInfo.RedirectStandardError = true; 69 javaCompileInfo.UseShellExecute = false; 70 javaCompileInfo.CreateNoWindow = true; 66 71 67 68 69 70 72 Process javaCompile = new Process(); 73 javaCompile.StartInfo = javaCompileInfo; 74 javaCompile.Start(); 75 javaCompile.WaitForExit(); 71 76 72 73 74 75 76 77 78 79 77 ProcessStartInfo evaluateCodeInfo = new ProcessStartInfo(); 78 evaluateCodeInfo.FileName = "cmd.exe"; 79 //javaCompileInfo.Arguments = "/C javac -cp C:\\robocode\\libs\\robocode.jar \"" + path + "\\Spaced Up\\output.java\""; 80 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*"; 81 //Console.WriteLine(javaCompileInfo.Arguments); 82 evaluateCodeInfo.RedirectStandardOutput = true; 83 evaluateCodeInfo.RedirectStandardError = true; 84 evaluateCodeInfo.UseShellExecute = false; 80 85 81 Process evaluateCode = new Process(); 82 evaluateCode.StartInfo = evaluateCodeInfo; 83 evaluateCode.Start(); 84 evaluateCode.WaitForExit(); 85 } 86 Process evaluateCode = new Process(); 87 evaluateCode.StartInfo = evaluateCodeInfo; 88 evaluateCode.Start(); 89 evaluateCode.WaitForExit(); 86 90 } 91 } 87 92 } -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/SolutionProgramView.Designer.cs
r9781 r9790 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System.Windows.Forms; 23 using HeuristicLab.Core.Views;24 23 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views; 25 using HeuristicLab.MainForm;26 24 27 25 namespace HeuristicLab.Problems.Robocode { -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/SolutionProgramView.cs
r9781 r9790 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab.
Note: See TracChangeset
for help on using the changeset viewer.