Changeset 15017 for branches/PushGP/HeuristicLab.PushGP/PushGP.Cli
- Timestamp:
- 06/01/17 09:28:34 (7 years ago)
- Location:
- branches/PushGP/HeuristicLab.PushGP/PushGP.Cli
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/PushGP.Cli/Program.cs
r14834 r15017 3 3 4 4 namespace HeuristicLab.Algorithms.PushGP.Cli { 5 using System.Collections.Generic; 6 using System.Linq; 7 5 8 using HeuristicLab.Problems.ProgramSynthesis.Push.Configuration; 9 using HeuristicLab.Problems.ProgramSynthesis.Push.Constants; 6 10 using HeuristicLab.Problems.ProgramSynthesis.Push.Interpreter; 7 11 8 12 class Program { 9 13 static void Main(string[] args) { 10 if (args.Length == 0) return;14 string code = null; 11 15 12 var code = args[0]; 16 if (args.Length == 0) { 17 var lines = new List<string>(); 18 19 Console.WriteLine(@"Program: ( must start with '(' and end with ')' )"); 20 21 var bracesCount = 0; 22 var linesRead = 0; 23 24 while (bracesCount > 0 || lines.Count == 0 || linesRead == 0) { 25 var line = Console.ReadLine(); 26 linesRead++; 27 28 if (string.IsNullOrWhiteSpace(line)) 29 continue; 30 31 line = line.Trim(); 32 lines.Add(line); 33 34 var openBraces = line.Count(c => c == PushEnvironment.ProgramStartSymbol); 35 var closeBraces = line.Count(c => c == PushEnvironment.ProgramEndSymbol); 36 bracesCount += openBraces - closeBraces; 37 } 38 39 code = string.Join(" ", lines); 40 } else { 41 code = args[0]; 42 } 43 13 44 EvaluateStepwise(code).Wait(); 14 45 15 Console. ReadKey();46 Console.WriteLine(@"Press any key to terminate..."); 16 47 } 17 48 -
branches/PushGP/HeuristicLab.PushGP/PushGP.Cli/Push.Cli.csproj
r14875 r15017 50 50 <Reference Include="System" /> 51 51 <Reference Include="System.Core" /> 52 <Reference Include="System.Windows.Forms" /> 52 53 <Reference Include="System.Xml.Linq" /> 53 54 <Reference Include="System.Data.DataSetExtensions" />
Note: See TracChangeset
for help on using the changeset viewer.