Changeset 9985
- Timestamp:
- 09/18/13 10:24:33 (11 years ago)
- Location:
- branches/Robocode.TrunkInt
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/HeuristicLab.Problems.Robocode.Views-3.3.csproj
r9971 r9985 108 108 <None Include="Plugin.cs.frame" /> 109 109 <None Include="Properties\AssemblyInfo.cs.frame" /> 110 <Compile Include="BattleRunnerDialog.cs"> 111 <SubType>Form</SubType> 112 </Compile> 113 <Compile Include="BattleRunnerDialog.Designer.cs"> 114 <DependentUpon>BattleRunnerDialog.cs</DependentUpon> 115 </Compile> 110 116 <Compile Include="EnemyCollectionView.cs"> 111 117 <SubType>UserControl</SubType> -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/SolutionCodeView.Designer.cs
r9890 r9985 26 26 this.programCode = new System.Windows.Forms.TextBox(); 27 27 this.btnRunInRobocode = new System.Windows.Forms.Button(); 28 this.btnSave = new System.Windows.Forms.Button(); 29 this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); 28 30 this.SuspendLayout(); 29 31 // … … 39 41 this.programCode.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 40 42 this.programCode.Size = new System.Drawing.Size(345, 203); 41 this.programCode.TabIndex = 3;43 this.programCode.TabIndex = 0; 42 44 // 43 45 // btnRunInRobocode … … 48 50 this.btnRunInRobocode.Name = "btnRunInRobocode"; 49 51 this.btnRunInRobocode.Size = new System.Drawing.Size(101, 23); 50 this.btnRunInRobocode.TabIndex = 4;52 this.btnRunInRobocode.TabIndex = 2; 51 53 this.btnRunInRobocode.Text = "Run in Robocode"; 52 54 this.btnRunInRobocode.UseVisualStyleBackColor = true; 53 55 this.btnRunInRobocode.Click += new System.EventHandler(this.btnRunInRobocode_Click); 56 // 57 // btnSave 58 // 59 this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 60 this.btnSave.AutoSize = true; 61 this.btnSave.Location = new System.Drawing.Point(166, 212); 62 this.btnSave.Name = "btnSave"; 63 this.btnSave.Size = new System.Drawing.Size(75, 23); 64 this.btnSave.TabIndex = 1; 65 this.btnSave.Text = "Save..."; 66 this.btnSave.UseVisualStyleBackColor = true; 67 this.btnSave.Click += new System.EventHandler(this.btnSave_Click); 68 // 69 // saveFileDialog 70 // 71 this.saveFileDialog.DefaultExt = "java"; 72 this.saveFileDialog.Filter = "Java |*java"; 54 73 // 55 74 // SolutionCodeView … … 57 76 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 58 77 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 78 this.Controls.Add(this.btnSave); 59 79 this.Controls.Add(this.btnRunInRobocode); 60 80 this.Controls.Add(this.programCode); … … 70 90 private System.Windows.Forms.TextBox programCode; 71 91 private System.Windows.Forms.Button btnRunInRobocode; 92 private System.Windows.Forms.Button btnSave; 93 private System.Windows.Forms.SaveFileDialog saveFileDialog; 72 94 } 73 95 } -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode.Views/3.3/SolutionCodeView.cs
r9947 r9985 21 21 22 22 using System; 23 using System.IO; 24 using System.Windows.Forms; 23 25 using HeuristicLab.Core.Views; 24 26 using HeuristicLab.MainForm; 27 using HeuristicLab.Problems.Robocode.Views; 25 28 26 29 namespace HeuristicLab.Problems.Robocode { … … 49 52 } 50 53 54 private void btnSave_Click(object sender, EventArgs e) { 55 saveFileDialog.FileName = programName; 56 var result = saveFileDialog.ShowDialog(this); 57 if (result == DialogResult.OK) 58 File.WriteAllText(saveFileDialog.FileName, programCode.Text); 59 } 60 51 61 private void btnRunInRobocode_Click(object sender, EventArgs e) { 52 Interpreter.EvaluateTankProgram(Content.Tree, Content.Path, Content.Enemies, programName, true, Content.NrOfRounds); 62 using (var battleRunnerDlg = new BattleRunnerDialog(Content)) { 63 var result = battleRunnerDlg.ShowDialog(this); 64 if (result == DialogResult.OK) { 65 var enemies = battleRunnerDlg.Enemies; 66 string path = enemies.RobocodePath; 67 int nrOfRounds = battleRunnerDlg.NrOfRounds; 68 Interpreter.EvaluateTankProgram(Content.Tree, path, enemies, programName, true, nrOfRounds); 69 } 70 } 53 71 } 54 72 } -
branches/Robocode.TrunkInt/HeuristicLab.Problems.Robocode/3.3/RobocodeProblem.cs
r9971 r9985 69 69 70 70 [StorableConstructor] 71 protected RobocodeProblem(bool deserializing) 72 : base(deserializing) { 73 if (deserializing) { 74 RegisterRobocodePathEvent(); 75 } 76 } 71 protected RobocodeProblem(bool deserializing) : base(deserializing) { } 77 72 protected RobocodeProblem(RobocodeProblem original, Cloner cloner) 78 73 : base(original, cloner) { 79 Register RobocodePathEvent();74 RegisterEventHandlers(); 80 75 } 81 76 … … 97 92 Maximization.Value = true; 98 93 InitializeOperators(); 94 RegisterEventHandlers(); 99 95 } 100 96 … … 103 99 } 104 100 101 [StorableHook(HookType.AfterDeserialization)] 102 private void AfterDeserialization() { 103 RegisterEventHandlers(); 104 } 105 105 106 private void InitializeOperators() { 106 Operators.AddRange( 107 ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>()); 107 Operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>()); 108 108 Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer()); 109 109 Operators.Add(new SymbolicExpressionSymbolFrequencyAnalyzer()); … … 111 111 ParameterizeOperators(); 112 112 ParameterizeAnalyzers(); 113 RegisterRobocodePathEvent();114 113 } 115 114 116 private void Register RobocodePathEvent() {115 private void RegisterEventHandlers() { 117 116 RobocodePathParameter.Value.StringValue.ValueChanged += RobocodePathParameter_ValueChanged; 118 117 }
Note: See TracChangeset
for help on using the changeset viewer.