Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 69ddc2f

Browse files
Removed extraneous loops from function generated code.
1 parent 833c76a commit 69ddc2f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

‎AIProgrammer.Functions/Concrete/StringFunction.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ public string Generate(IGeneticAlgorithm ga)
7070

7171
// Run the genetic algorithm and get the best brain.
7272
program = GAManager.Run(ga, _fitnessFunc, _generationFunc);
73-
73+
74+
// Trim extraneous loop instructions from the end.
75+
program = program.Replace("[]", "");
76+
7477
appendCode += program + "@";
7578

7679
// Reset the target fitness.

‎AIProgrammer.Functions/Concrete/StringFunctionChunk.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ public string Generate(IGeneticAlgorithm ga)
102102

103103
// Run the genetic algorithm and get the best brain.
104104
program = GAManager.Run(ga, _fitnessFunc, _generationFunc);
105-
105+
106+
// Trim extraneous loop instructions from the end.
107+
program = program.Replace("[]", "");
108+
106109
appendCode += program + "@";
107110

108111
// Reset the target fitness.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /