├── .github └── FUNDING.yml ├── .gitignore ├── AIProgrammer.Compiler ├── AIProgrammer.Compiler.csproj ├── BrainPlus.cs └── Properties │ └── AssemblyInfo.cs ├── AIProgrammer.Database ├── AIProgrammer.Database.csproj ├── Concrete │ ├── BaseDatabase.cs │ ├── BinaryDatabase.cs │ └── XmlDatabase.cs ├── Interface │ └── IDatabase.cs └── Properties │ └── AssemblyInfo.cs ├── AIProgrammer.Fitness ├── AIProgrammer.Fitness.csproj ├── Base │ └── FitnessBase.cs ├── Concrete │ ├── AddCleanFitness.cs │ ├── AddFitness.cs │ ├── BottlesOfBeerFitness.cs │ ├── CountdownFitness.cs │ ├── CsvSplitFitness.cs │ ├── ExtractInQuotes2Fitness.cs │ ├── ExtractInQuotesFitness.cs │ ├── FibonacciFitness.cs │ ├── FindQuoteFitness.cs │ ├── GuidingFunctionFitness.cs │ ├── HelloUserFitness.cs │ ├── IfThenFitness.cs │ ├── InnerTextFitness.cs │ ├── LessThanEqualToFitness.cs │ ├── LogicalAndFitness.cs │ ├── LogicalOrFitness.cs │ ├── LogicalXorFitness.cs │ ├── Research │ │ ├── AddToCharFitness.cs │ │ ├── MultiplyFitness.cs │ │ └── NumberGuessFitness.cs │ ├── ReverseStringFitness.cs │ ├── StringFitness.cs │ ├── StringLengthFitness.cs │ ├── StringOptimizedFitness.cs │ ├── StringStrictFitness.cs │ ├── SubtractFitness.cs │ ├── TimesThreeFitness.cs │ ├── TimesTwoFitness.cs │ ├── TrimLeftOfQuoteFitness.cs │ ├── WarningCountdownFitness.cs │ └── XmlToJsonFitness.cs └── Properties │ └── AssemblyInfo.cs ├── AIProgrammer.Functions ├── AIProgrammer.Functions.csproj ├── Concrete │ ├── StringFunction.cs │ └── StringFunctionChunk.cs └── Properties │ └── AssemblyInfo.cs ├── AIProgrammer.GA ├── AIProgrammer.GeneticAlgorithm.csproj ├── GA.cs └── Properties │ └── AssemblyInfo.cs ├── AIProgrammer.Interpreter ├── AIProgrammer.Interpreter.csproj ├── Interpreter.cs └── Properties │ └── AssemblyInfo.cs ├── AIProgrammer.Managers ├── AIProgrammer.Managers.csproj ├── CommonManager.cs ├── GAManager.cs ├── LogManager.cs └── Properties │ └── AssemblyInfo.cs ├── AIProgrammer.Repository ├── AIProgrammer.Repository.csproj ├── Concrete │ └── GARepository.cs ├── Interface │ └── IRepository.cs └── Properties │ └── AssemblyInfo.cs ├── AIProgrammer.Types ├── AIProgrammer.Types.csproj ├── Function.cs ├── FunctionInst.cs ├── GAParams.cs ├── GAStatus.cs ├── Genome.cs ├── Interface │ ├── IFitness.cs │ ├── IFunction.cs │ └── IGeneticAlgorithm.cs ├── Properties │ └── AssemblyInfo.cs └── TargetParams.cs ├── AIProgrammer.sln ├── AIProgrammer ├── AIProgrammer.csproj ├── App.config ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── README.md ├── Results ├── 99bottlesofbeer │ ├── 99bottlesofbeer-a.jpg │ ├── 99bottlesofbeer-b.jpg │ ├── 99bottlesofbeer-c.jpg │ ├── 99bottlesofbeer-d.png │ ├── 99bottlesofbeer-e.png │ ├── 99bottlesofbeer-history.txt │ ├── 99bottlesofbeer.exe │ └── 99bottlesofbeer.txt ├── Hi! │ ├── Hi!.exe │ ├── Hi!.txt │ ├── ai-programmer-hii-1.jpg │ ├── ai-programmer-hii-2.jpg │ ├── ai-programmer-hii-3.jpg │ ├── history.txt │ └── history.xlsx ├── I love all humans │ ├── ai-programmer-iloveallhumans-1.jpg │ ├── ai-programmer-iloveallhumans-2.jpg │ ├── ai-programmer-iloveallhumans-3.jpg │ ├── iloveallhumans.exe │ ├── iloveallhumans.txt │ └── iloveallhumans2.jpg ├── add │ ├── add-history.txt │ ├── add.exe │ ├── add.txt │ ├── add1.jpg │ ├── add3.jpg │ └── add5.jpg ├── cats are evil │ ├── ifthen-3-history.txt │ ├── ifthen-3.exe │ ├── ifthen3-1.jpg │ ├── ifthen3-2.jpg │ ├── ifthen3-3.jpg │ ├── ifthen3-history.xlsx │ └── ifthen3.txt ├── csv split │ ├── csvsplit-1.png │ ├── csvsplit-2.png │ ├── csvsplit.exe │ ├── history.txt │ └── program.txt ├── extractinquotes │ ├── extract-in-quotes-1.png │ ├── extractinquotes.exe │ ├── history.txt │ └── program.txt ├── extractinquotes2 │ ├── extract-in-quotes-1.png │ ├── extract-in-quotes-2-1.png │ ├── extract-in-quotes-2-2.png │ ├── extract-in-quotes-2-3.png │ ├── extract-in-quotes-2.exe │ ├── extract-in-quotes-2.png │ ├── extract-in-quotes.exe │ ├── history-2.txt │ └── history.txt ├── fibonacci │ ├── fibonacci-2 │ │ ├── fibonacci-2-history.txt │ │ ├── fibonacci-2.exe │ │ └── fibonacci-2.jpg │ ├── fibonacci-3 │ │ ├── fibbonaci-3a.jpg │ │ ├── fibonacci-3b.jpg │ │ ├── fibonnaci-3-history.txt │ │ └── fibonnaci-3.exe │ └── fibonacci-4 │ │ ├── fibonacci-4-history.txt │ │ ├── fibonnaci-4.exe │ │ ├── fibonnaci-4.txt │ │ ├── fibonnaci-4a.jpg │ │ ├── fibonnaci-4b.jpg │ │ ├── fibonnaci-4c.jpg │ │ └── fibonnaci-4d.png ├── hello world │ ├── ai-programmer-helloworld-1.jpg │ ├── ai-programmer-helloworld-2.jpg │ ├── hello world.txt │ ├── helloworld.exe │ ├── history.txt │ └── history.xlsx ├── hello-user │ ├── hellouser-history.txt │ ├── hellouser.exe │ ├── hellouser.txt │ ├── hellouser1.jpg │ └── hellouser2.jpg ├── hello │ ├── ai-programmer-hello-1.jpg │ ├── ai-programmer-hello-2.jpg │ ├── ai-programmer-hello-3.jpg │ ├── ai-programmer-hello-4.jpg │ ├── hello.exe │ ├── hello.txt │ ├── history.txt │ └── history.xlsx ├── hi │ ├── ai-programmer-hi-1.jpg │ ├── ai-programmer-hi-2.jpg │ ├── ai-programmer-hi-3.jpg │ ├── ai-programmer-hi-4.jpg │ ├── ai-programmer-hi-5.jpg │ ├── ai-programmer-hi.xlsx │ ├── hi.exe │ ├── hi.txt │ └── history.txt ├── if-then │ ├── ifthen-1.jpg │ ├── ifthen-2.jpg │ ├── ifthen-history.txt │ ├── ifthen.exe │ ├── ifthen.txt │ ├── ifthen2-1.jpg │ ├── ifthen2-2.jpg │ ├── ifthen2-3.jpg │ ├── ifthen2-history.txt │ ├── ifthen2.exe │ └── ifthen2.txt ├── keepcalmkeepcoding │ ├── keepcalmkeepcoding-a.jpg │ ├── keepcalmkeepcoding-history.txt │ ├── keepcalmkeepcoding.exe │ └── keepcalmkeepcoding.txt ├── logical-xor │ ├── history.txt │ ├── program.txt │ ├── xor-1.png │ ├── xor-2.png │ └── xor.exe ├── reddit │ ├── ai-programmer-reddit-1.jpg │ ├── ai-programmer-reddit-2.jpg │ ├── ai-programmer-reddit-3.jpg │ ├── history.txt │ ├── history.xlsx │ ├── reddit.exe │ └── reddit.txt ├── reverse-string │ ├── reverse-history.txt │ ├── reverse.exe │ ├── reverse.txt │ ├── reverse1.jpg │ └── reverse2.jpg ├── string-length │ ├── history.txt │ ├── output.exe │ └── string-length-1.png ├── subtract │ ├── subtract-history.txt │ ├── subtract.exe │ ├── subtract.txt │ ├── subtract11.jpg │ ├── subtract2-history.txt │ ├── subtract2.exe │ ├── subtract2.txt │ ├── subtract21.jpg │ └── subtract23.jpg ├── timesthree │ ├── timesthree-a.jpg │ ├── timesthree-b.jpg │ ├── timesthree-c.png │ ├── timesthree-history.txt │ ├── timesthree.exe │ └── timesthree.txt ├── timestwo │ ├── timestwo-a.jpg │ ├── timestwo-b.jpg │ ├── timestwo-c.png │ ├── timestwo-history.txt │ ├── timestwo.exe │ └── timestwo.txt ├── trimleftofquote │ ├── history.txt │ ├── program.txt │ └── trimleftofquote-1.png ├── warningcountdown │ ├── history.txt │ ├── program.txt │ ├── warningcountdown.exe │ ├── warningcountdown1.png │ ├── warningcountdown2.png │ └── warningcountdown3.png └── xml2json │ ├── history.txt │ ├── program.txt │ ├── xml2json.exe │ ├── xmltojson-1.png │ └── xmltojson-2.png └── lib └── Newtonsoft.Json.dll /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [primaryobjects] 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.cache 2 | *.dll 3 | *.pdb 4 | *.suo 5 | *.exe 6 | *.exe.config 7 | *.exe.manifest 8 | !README.txt 9 | !lib/*.dll 10 | *.xml 11 | Debug/ 12 | Release/ -------------------------------------------------------------------------------- /AIProgrammer.Compiler/AIProgrammer.Compiler.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {5F99B6A4-5CB2-432B-8018-E2EDFBB957F7} 8 | Library 9 | Properties 10 | AIProgrammer.Compiler 11 | AIProgrammer.Compiler 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | {2fa2525f-4faa-45a6-8268-4d561f7c46f9} 48 | AIProgrammer.Fitness 49 | 50 | 51 | {8ec97de8-ddfd-437a-b216-91db8d1a3487} 52 | AIProgrammer.GeneticAlgorithm 53 | 54 | 55 | {7bcc43b1-33a8-44c8-8f4d-752d89672180} 56 | AIProgrammer.Types 57 | 58 | 59 | 60 | 67 | -------------------------------------------------------------------------------- /AIProgrammer.Compiler/BrainPlus.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Types.Interface; 2 | using AIProgrammer.Fitness; 3 | using Microsoft.CSharp; 4 | using System; 5 | using System.CodeDom.Compiler; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Reflection; 9 | 10 | namespace AIProgrammer.Compiler 11 | { 12 | /// 13 | /// Usage: Compiler.Compile("++++.", "StringFitness", 2000); 14 | /// Output: exe file thats runs the brainfuck code. 15 | /// 16 | public static class BrainPlus 17 | { 18 | /// 19 | /// Compiles brainfuck code into an executable. 20 | /// 21 | /// Brainfuck source code 22 | /// Executable file path 23 | /// IFitness 24 | /// True to display the header (Brainfuck .NET Compiler 1.0, Created by ...). 25 | public static void Compile(string program, string pathName, IFitness fitness, bool includeHeader = true) 26 | { 27 | Compile(program, pathName, fitness.GetType().Name, fitness.GetConstructorParameters()); 28 | } 29 | 30 | /// 31 | /// Compiles brainfuck code into an executable. 32 | /// 33 | /// Brainfuck source code 34 | /// Executable file path 35 | /// string (HelloUserFitness, StringOptimizedFitness, etc) 36 | /// Parameters to pass to fitness method constructor, after GA. 37 | /// True to display the header (Brainfuck .NET Compiler 1.0, Created by ...). 38 | public static void Compile(string program, string pathName, string fitnessMethod, string constructorParams, bool includeHeader = true) 39 | { 40 | string sourceCode = @" 41 | using System; 42 | using AIProgrammer.Fitness.Concrete; 43 | using AIProgrammer.Types.Interface; 44 | 45 | class Program { 46 | public static void Main(string[] args) 47 | { 48 | string program = ""[SOURCE]""; 49 | IFitness fitness = new [FITNESSMETHOD](null, [PARAMETERS]); 50 | 51 | // Specify -s to supress header text. 52 | if (args.Length == 0 || args[0] != ""-s"") 53 | { 54 | [HEADER] 55 | } 56 | 57 | Console.WriteLine(fitness.RunProgram(program)); 58 | 59 | Console.WriteLine(); 60 | if (args.Length == 0 || args[0] != ""-s"") 61 | { 62 | Console.Write(""Press any key to continue..""); 63 | Console.ReadKey(); 64 | } 65 | } 66 | }"; 67 | 68 | CSharpCodeProvider provider = new CSharpCodeProvider(new Dictionary() { { "CompilerVersion", "v4.0" } }); 69 | CompilerParameters parameters = new CompilerParameters(new [] { "mscorlib.dll", "System.Core.dll" }, pathName, true); 70 | parameters.GenerateExecutable = true; 71 | parameters.ReferencedAssemblies.Add(Assembly.GetAssembly(typeof(AIProgrammer.Fitness.Concrete.StringFitness)).Location); 72 | parameters.ReferencedAssemblies.Add(Assembly.GetAssembly(typeof(AIProgrammer.Types.Interface.IFitness)).Location); 73 | parameters.ReferencedAssemblies.Add(Assembly.GetAssembly(typeof(AIProgrammer.GeneticAlgorithm.GA)).Location); 74 | 75 | if (includeHeader) 76 | { 77 | sourceCode = sourceCode.Replace("[HEADER]", @" 78 | Console.WriteLine(""BrainPlus Compiler 1.0""); 79 | Console.WriteLine(""Created by Kory Becker""); 80 | Console.WriteLine(""http://www.primaryobjects.com/kory-becker.aspx""); 81 | Console.WriteLine(""Running program:""); 82 | Console.WriteLine(""" + program + @"""); 83 | Console.WriteLine();"); 84 | } 85 | else 86 | { 87 | sourceCode = sourceCode.Replace("[HEADER]", ""); 88 | } 89 | 90 | sourceCode = sourceCode.Replace("[SOURCE]", program); 91 | sourceCode = sourceCode.Replace("[FITNESSMETHOD]", fitnessMethod); 92 | sourceCode = sourceCode.Replace("[PARAMETERS]", constructorParams); 93 | 94 | CompilerResults results = provider.CompileAssemblyFromSource(parameters, sourceCode); 95 | 96 | results.Errors.Cast().ToList().ForEach(error => Console.WriteLine(error.ErrorText)); 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /AIProgrammer.Compiler/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AIProgrammer.Compiler")] 9 | [assembly: AssemblyDescription("AIProgrammer.Compiler")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AIProgrammer.Compiler")] 13 | [assembly: AssemblyCopyright("Copyright © 2015 Kory Becker")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("75493eac-55db-45d4-b813-f71bce58e5a5")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AIProgrammer.Database/AIProgrammer.Database.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D65CDC62-78AD-4FF7-B04A-E58B78E0B077} 8 | Library 9 | Properties 10 | AIProgrammer.Database 11 | AIProgrammer.Database 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 56 | -------------------------------------------------------------------------------- /AIProgrammer.Database/Concrete/BaseDatabase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using AIProgrammer.Database.Interface; 4 | 5 | namespace AIProgrammer.Database.Concrete 6 | { 7 | public abstract class BaseDatabase : IDatabase where T : class 8 | { 9 | protected string _filePath; 10 | 11 | public BaseDatabase(string filePath) 12 | { 13 | _filePath = filePath; 14 | 15 | // Get the directory of the filePath, not including the filename. 16 | int lastSlashIndex = _filePath.LastIndexOf('\\'); 17 | string directory = _filePath.Substring(0, lastSlashIndex); 18 | 19 | // Create the preferences directory if it doesn't exist. 20 | if (!Directory.Exists(directory)) 21 | { 22 | Directory.CreateDirectory(directory); 23 | } 24 | } 25 | 26 | #region IDatabase Members 27 | 28 | public abstract List ReadEntities(); 29 | public abstract void WriteEntities(List entities); 30 | 31 | #endregion 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /AIProgrammer.Database/Concrete/BinaryDatabase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Runtime.Serialization.Formatters.Binary; 4 | 5 | namespace AIProgrammer.Database.Concrete 6 | { 7 | public class BinaryDatabase : BaseDatabase where T : class 8 | { 9 | public BinaryDatabase(string filePath) 10 | : base(filePath) 11 | { 12 | } 13 | 14 | #region IDatabase Members 15 | 16 | public override List ReadEntities() 17 | { 18 | List entities = new List(); 19 | 20 | if (File.Exists(_filePath)) 21 | { 22 | using (FileStream stream = new FileStream(_filePath, FileMode.Open)) 23 | { 24 | BinaryFormatter binaryFormatter = new BinaryFormatter(); 25 | entities = (List)binaryFormatter.Deserialize(stream); 26 | } 27 | } 28 | 29 | return entities; 30 | } 31 | 32 | public override void WriteEntities(List entities) 33 | { 34 | using (FileStream stream = new FileStream(_filePath, FileMode.Create)) 35 | { 36 | BinaryFormatter binaryFormatter = new BinaryFormatter(); 37 | binaryFormatter.Serialize(stream, entities); 38 | } 39 | } 40 | 41 | #endregion 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /AIProgrammer.Database/Concrete/XmlDatabase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Xml; 4 | using System.Xml.Serialization; 5 | 6 | namespace AIProgrammer.Database.Concrete 7 | { 8 | public class XmlDatabase : BaseDatabase where T : class 9 | { 10 | public XmlDatabase(string filePath) 11 | : base(filePath) 12 | { 13 | } 14 | 15 | #region IDatabase Members 16 | 17 | public override List ReadEntities() 18 | { 19 | List entities = new List(); 20 | 21 | if (File.Exists(_filePath)) 22 | { 23 | using (StreamReader stream = new StreamReader(_filePath)) 24 | { 25 | using (XmlReader reader = XmlReader.Create(stream)) 26 | { 27 | try 28 | { 29 | XmlSerializer xmlSerializer = new XmlSerializer(entities.GetType()); 30 | entities = (List)xmlSerializer.Deserialize(reader); 31 | } 32 | catch 33 | { 34 | // Error deserializing the data. Possibly, invalid XML. Just return an empty list to clear the file out. This data is not important, just effects the urls shown in the main view. 35 | } 36 | } 37 | } 38 | } 39 | 40 | return entities; 41 | } 42 | 43 | public override void WriteEntities(List entities) 44 | { 45 | using (StreamWriter stream = new StreamWriter(_filePath, false)) 46 | { 47 | XmlSerializer xmlSerializer = new XmlSerializer(entities.GetType()); 48 | xmlSerializer.Serialize(stream, entities); 49 | } 50 | } 51 | 52 | #endregion 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /AIProgrammer.Database/Interface/IDatabase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace AIProgrammer.Database.Interface 4 | { 5 | public interface IDatabase where T : class 6 | { 7 | List ReadEntities(); 8 | void WriteEntities(List entities); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /AIProgrammer.Database/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AIProgrammer.Database")] 9 | [assembly: AssemblyDescription("AIProgrammer.Database")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AIProgrammer.Database")] 13 | [assembly: AssemblyCopyright("Copyright © 2015 Kory Becker")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("6f0d9ba2-f4c4-45dd-93fb-b5382f636ce3")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/AIProgrammer.Fitness.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {2FA2525F-4FAA-45A6-8268-4D561F7C46F9} 8 | Library 9 | Properties 10 | AIProgrammer.Fitness 11 | AIProgrammer.Fitness 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | False 35 | ..\lib\Newtonsoft.Json.dll 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | {8ec97de8-ddfd-437a-b216-91db8d1a3487} 83 | AIProgrammer.GeneticAlgorithm 84 | 85 | 86 | {4f4f1800-be33-4d38-ad95-6835644c076e} 87 | AIProgrammer.Interpreter 88 | 89 | 90 | {06d57f9c-a784-433f-8ff3-0728fecf6f5c} 91 | AIProgrammer.Managers 92 | 93 | 94 | {7bcc43b1-33a8-44c8-8f4d-752d89672180} 95 | AIProgrammer.Types 96 | 97 | 98 | 99 | 106 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Base/FitnessBase.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Types.Interface; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using AIProgrammer.Managers; 9 | 10 | namespace AIProgrammer.Fitness.Base 11 | { 12 | public abstract class FitnessBase : IFitness 13 | { 14 | public string Program { get; set; } // Brainfuck source code. 15 | public string MainProgram { get; set; } // Main program Brainfuck source code (not including any appended functions). 16 | public string Output { get; set; } // Program execution output. 17 | public double Fitness { get; set; } // Fitness used for determining solution fitness (ie., true fitness). 18 | public double TargetFitness { get { return _targetFitness; } } // Target fitness to achieve solution. 19 | public int Ticks { get; set; } // Number of instructions executed by the best program. 20 | public int TotalTicks { get; set; } // Number of instructions executed by the best program, including functions. 21 | 22 | #region Settings 23 | 24 | /// 25 | /// Program code, containing functions, that will be appended to main program code. 26 | /// 27 | public virtual string AppendCode { get; } 28 | /// 29 | /// Percentage chance that a child genome will use crossover of two parents. Default 0.7 30 | /// 31 | public virtual double? CrossoverRate { get; } 32 | /// 33 | /// Percentage chance that a child genome will mutate a gene. Default 0.01 34 | /// 35 | public virtual double? MutationRate { get; } 36 | /// 37 | /// Number of programming instructions in generated program (size of genome array). loops). Default 100 38 | /// 39 | public virtual int? GenomeSize { get; } 40 | /// 41 | /// The max length a genome may grow to (only applicable if _expandAmount > 0). Default 100 42 | /// 43 | public virtual int? MaxGenomeSize { get; } 44 | /// 45 | /// Max iterations a program may run before being killed (prevents infinite loops). Default 5000 46 | /// 47 | public virtual int? MaxIterationCount { get; } 48 | /// 49 | /// The max genome size will expand by this amount, every _expandRate iterations (may help learning). Set to 0 to disable. Default 0 50 | /// 51 | public virtual int? ExpandAmount { get; } 52 | /// 53 | /// The max genome size will expand by _expandAmount, at this interval of generations. Default 5000 54 | /// 55 | public virtual int? ExpandRate { get; } 56 | 57 | #endregion 58 | 59 | protected double _fitness = 0; // Total fitness to return to genetic algorithm (may be variable, solution is not based upon this value, just the rank). 60 | protected static double _targetFitness = 0; // Target fitness to achieve. Static so we only evaluate this once across instantiations of the fitness class. 61 | protected int _maxIterationCount = 2000; // Max iterations a program may run before being killed (prevents infinite loops). 62 | protected string _appendFunctions = null; // Function code to append to program. 63 | protected StringBuilder _console = new StringBuilder(); // Used by classes to collect console output. 64 | protected StringBuilder _output = new StringBuilder(); // Used by classes to collect and concat output for assigning to Output. 65 | protected Interpreter _bf = null; // Brainfuck interpreter instance 66 | protected GA _ga; // Shared genetic algorithm instance 67 | 68 | public FitnessBase(GA ga, int maxIterationCount) 69 | { 70 | _ga = ga; 71 | _maxIterationCount = maxIterationCount; 72 | Output = ""; 73 | Program = ""; 74 | } 75 | 76 | public FitnessBase(GA ga, int maxIterationCount, string appendFunctions) 77 | : this(ga, maxIterationCount) 78 | { 79 | _appendFunctions = appendFunctions; 80 | } 81 | 82 | protected bool IsFitnessAchieved() 83 | { 84 | bool result = false; 85 | 86 | // Did we find a perfect fitness? 87 | if (Fitness >= TargetFitness) 88 | { 89 | // We're done! Stop the GA algorithm. 90 | // Note, you can alternatively use the _ga.GAParams.TargetFitness to set a specific fitness to achieve. 91 | // In our case, the number of ticks (instructions executed) is a variable part of the fitness, so we don't know the exact perfect fitness value once this part is added. 92 | _ga.Stop = true; 93 | 94 | // Set this genome as the solution. 95 | _fitness = Double.MaxValue; 96 | 97 | result = true; 98 | } 99 | 100 | return result; 101 | } 102 | 103 | #region IFitness Members 104 | 105 | public double GetFitness(double[] weights) 106 | { 107 | // Get the resulting Brainfuck program. 108 | MainProgram = Program = CommonManager.ConvertDoubleArrayToBF(weights); 109 | 110 | // Append any functions to the program. 111 | if (_appendFunctions != null) 112 | { 113 | Program += "@" + _appendFunctions; 114 | } 115 | 116 | // Get the fitness. 117 | double fitness = GetFitnessMethod(Program); 118 | 119 | // Get the output. 120 | if (_output.Length > 0) 121 | { 122 | Output = _output.ToString().TrimEnd(','); 123 | } 124 | 125 | return fitness; 126 | } 127 | 128 | public void ResetTargetFitness() 129 | { 130 | _targetFitness = 0; 131 | } 132 | 133 | public string RunProgram(string program) 134 | { 135 | RunProgramMethod(program); 136 | 137 | return _console.ToString(); 138 | } 139 | 140 | public abstract string GetConstructorParameters(); 141 | 142 | #endregion 143 | 144 | protected abstract double GetFitnessMethod(string program); 145 | protected abstract void RunProgramMethod(string program); 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Concrete/AddCleanFitness.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Base; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using AIProgrammer.Managers; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace AIProgrammer.Fitness.Concrete 11 | { 12 | /// 13 | /// Calculates the sum of various input integers and outputs the result as byte values (ie., 3 => 3, you would need to do a ToString() to display it on the console). 14 | /// Only checks the output after the two inputs have been provided, and only considers one output. Ignores the rest. 15 | /// Note, input is taken in byte value (not ASCII character) so you will probably get different results if you run results on web-based interpreters, as those usually translate inputs into ASCII values. 16 | /// 17 | public class AddCleanFitness : FitnessBase 18 | { 19 | private int _trainingCount; 20 | 21 | public AddCleanFitness(GA ga, int maxIterationCount, int maxTrainingCount = 5) 22 | : base(ga, maxIterationCount) 23 | { 24 | _trainingCount = maxTrainingCount; 25 | if (_targetFitness == 0) 26 | { 27 | _targetFitness = _trainingCount * 256; 28 | } 29 | } 30 | 31 | #region FitnessBase Members 32 | 33 | protected override double GetFitnessMethod(string program) 34 | { 35 | byte input1 = 0, input2 = 0; 36 | int state = 0; 37 | double countBonus = 0; 38 | 39 | for (int i = 0; i < _trainingCount; i++) 40 | { 41 | switch (i) 42 | { 43 | case 0: input1 = 1; input2 = 2; break; 44 | case 1: input1 = 3; input2 = 4; break; 45 | case 2: input1 = 5; input2 = 1; break; 46 | case 3: input1 = 6; input2 = 2; break; 47 | case 4: input1 = 3; input2 = 6; break; 48 | }; 49 | 50 | try 51 | { 52 | state = 0; 53 | _console.Clear(); 54 | 55 | // Run the program. 56 | _bf = new Interpreter(program, () => 57 | { 58 | if (state == 0) 59 | { 60 | state++; 61 | return input1; 62 | } 63 | else if (state == 1) 64 | { 65 | state++; 66 | return input2; 67 | } 68 | else 69 | { 70 | return 0; 71 | } 72 | }, 73 | (b) => 74 | { 75 | if (state == 2 && _console.Length == 0) 76 | { 77 | _console.Append(b.ToString()); 78 | } 79 | }); 80 | _bf.Run(_maxIterationCount); 81 | } 82 | catch 83 | { 84 | } 85 | 86 | // Order bonus. 87 | if (_console.Length > 0) 88 | { 89 | _output.Append(_console.ToString()); 90 | _output.Append(", "); 91 | 92 | Byte value = Byte.Parse(_console.ToString()); 93 | Fitness += 256 - Math.Abs(value - (input1 + input2)); 94 | } 95 | 96 | // Check for solution. 97 | IsFitnessAchieved(); 98 | 99 | // Bonus for less operations to optimize the code. 100 | countBonus += ((_maxIterationCount - _bf.m_Ticks) / 1000.0); 101 | 102 | Ticks += _bf.m_Ticks; 103 | } 104 | 105 | if (_fitness != Double.MaxValue) 106 | { 107 | _fitness = Fitness + countBonus; 108 | } 109 | 110 | return _fitness; 111 | } 112 | 113 | protected override void RunProgramMethod(string program) 114 | { 115 | for (int i = 0; i < 99; i++) 116 | { 117 | try 118 | { 119 | int state = 0; 120 | bool alreadyDisplayed = false; 121 | 122 | // Run the program. 123 | Interpreter bf = new Interpreter(program, () => 124 | { 125 | if (state == 0) 126 | { 127 | state++; 128 | Console.Write(">: "); 129 | byte b = Byte.Parse(Console.ReadLine()); 130 | return b; 131 | } 132 | else if (state == 1) 133 | { 134 | state++; 135 | Console.Write(">: "); 136 | byte b = Byte.Parse(Console.ReadLine()); 137 | return b; 138 | } 139 | else 140 | { 141 | return 0; 142 | } 143 | }, 144 | (b) => 145 | { 146 | if (state == 2 && !alreadyDisplayed) 147 | { 148 | alreadyDisplayed = true; 149 | Console.Write(b.ToString()); 150 | } 151 | }); 152 | 153 | bf.Run(_maxIterationCount); 154 | } 155 | catch 156 | { 157 | } 158 | } 159 | } 160 | 161 | public override string GetConstructorParameters() 162 | { 163 | return _maxIterationCount + ", " + _trainingCount; 164 | } 165 | 166 | #endregion 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Concrete/AddFitness.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Base; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using AIProgrammer.Managers; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace AIProgrammer.Fitness.Concrete 11 | { 12 | /// 13 | /// Calculates the sum of various input integers and outputs the result as byte values (ie., 3 => 3, you would need to do a ToString() to display it on the console). 14 | /// Note, input is taken in byte value (not ASCII character) so you will probably get different results if you run results on web-based interpreters, as those usually translate inputs into ASCII values. 15 | /// 16 | public class AddFitness : FitnessBase 17 | { 18 | private int _trainingCount; 19 | 20 | public AddFitness(GA ga, int maxIterationCount, int maxTrainingCount = 3) 21 | : base(ga, maxIterationCount) 22 | { 23 | _trainingCount = maxTrainingCount; 24 | if (_targetFitness == 0) 25 | { 26 | _targetFitness = _trainingCount * 256; 27 | } 28 | } 29 | 30 | #region FitnessBase Members 31 | 32 | protected override double GetFitnessMethod(string program) 33 | { 34 | byte input1 = 0, input2 = 0; 35 | int state = 0; 36 | double countBonus = 0; 37 | 38 | for (int i = 0; i < _trainingCount; i++) 39 | { 40 | switch (i) 41 | { 42 | case 0: input1 = 1; input2 = 2; break; 43 | case 1: input1 = 3; input2 = 4; break; 44 | case 2: input1 = 5; input2 = 1; break; 45 | case 3: input1 = 6; input2 = 2; break; 46 | case 4: input1 = 3; input2 = 6; break; 47 | case 5: input1 = 2; input2 = 0; break; 48 | }; 49 | 50 | try 51 | { 52 | state = 0; 53 | _console.Clear(); 54 | 55 | // Run the program. 56 | _bf = new Interpreter(program, () => 57 | { 58 | if (state == 0) 59 | { 60 | state++; 61 | return input1; 62 | } 63 | else if (state == 1) 64 | { 65 | state++; 66 | return input2; 67 | } 68 | else 69 | { 70 | return 0; 71 | } 72 | }, 73 | (b) => 74 | { 75 | _console.Append(b.ToString()); 76 | }); 77 | _bf.Run(_maxIterationCount); 78 | } 79 | catch 80 | { 81 | } 82 | 83 | // Order bonus. 84 | if (_console.Length > 0) 85 | { 86 | _output.Append(_console.ToString()); 87 | _output.Append(","); 88 | 89 | int value; 90 | if (Int32.TryParse(_console.ToString(), out value)) 91 | { 92 | Fitness += 256 - Math.Abs(value - (input1 + input2)); 93 | } 94 | } 95 | 96 | // Check for solution. 97 | IsFitnessAchieved(); 98 | 99 | // Bonus for less operations to optimize the code. 100 | countBonus += ((_maxIterationCount - _bf.m_Ticks) / 1000.0); 101 | 102 | Ticks += _bf.m_Ticks; 103 | } 104 | 105 | if (_fitness != Double.MaxValue) 106 | { 107 | _fitness = Fitness + countBonus; 108 | } 109 | 110 | return _fitness; 111 | } 112 | 113 | protected override void RunProgramMethod(string program) 114 | { 115 | for (int i = 0; i < 99; i++) 116 | { 117 | try 118 | { 119 | int state = 0; 120 | 121 | // Run the program. 122 | Interpreter bf = new Interpreter(program, () => 123 | { 124 | if (state == 0) 125 | { 126 | state++; 127 | Console.WriteLine(); 128 | Console.Write(">: "); 129 | byte b = Byte.Parse(Console.ReadLine()); 130 | return b; 131 | } 132 | else if (state == 1) 133 | { 134 | state++; 135 | Console.WriteLine(); 136 | Console.Write(">: "); 137 | byte b = Byte.Parse(Console.ReadLine()); 138 | return b; 139 | } 140 | else 141 | { 142 | return 0; 143 | } 144 | }, 145 | (b) => 146 | { 147 | Console.Write(b.ToString()); 148 | }); 149 | 150 | bf.Run(_maxIterationCount); 151 | } 152 | catch 153 | { 154 | } 155 | } 156 | } 157 | 158 | public override string GetConstructorParameters() 159 | { 160 | return _maxIterationCount + ", " + _trainingCount; 161 | } 162 | 163 | #endregion 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Concrete/CountdownFitness.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Base; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using AIProgrammer.Managers; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace AIProgrammer.Fitness.Concrete 11 | { 12 | /// 13 | /// Outputs a countdown from an input number. Note, input is taken in byte value. 14 | /// Example: input = 5: 543210 15 | /// 16 | public class CountdownFitness : FitnessBase 17 | { 18 | private int _trainingCount; 19 | 20 | public CountdownFitness(GA ga, int maxIterationCount, int maxTrainingCount = 4) 21 | : base(ga, maxIterationCount) 22 | { 23 | _trainingCount = maxTrainingCount; 24 | 25 | if (_targetFitness == 0) 26 | { 27 | // A * 256 => A = Number of numeric values in training example, 256 = 256 characters per byte. 28 | _targetFitness += 6 * 256; 29 | _targetFitness += 4 * 256; 30 | _targetFitness += 3 * 256; 31 | _targetFitness += 7 * 256; 32 | } 33 | } 34 | 35 | #region FitnessBase Members 36 | 37 | protected override double GetFitnessMethod(string program) 38 | { 39 | byte[][] trainingExamples = { new byte[] { 5, 4, 3, 2, 1, 0 }, 40 | new byte[] { 3, 2, 1, 0 }, 41 | new byte[] { 2, 1, 0 }, 42 | new byte[] { 6, 5, 4, 3, 2, 1, 0 } }; 43 | double countBonus = 0; 44 | double penalty = 0; 45 | 46 | for (int i = 0; i < trainingExamples.Length; i++) 47 | { 48 | try 49 | { 50 | int state = 0; 51 | _console.Clear(); 52 | 53 | // Run the program. 54 | _bf = new Interpreter(program, () => 55 | { 56 | if (state == 0) 57 | { 58 | state++; 59 | 60 | // Send input. 61 | return trainingExamples[i][0]; 62 | } 63 | else 64 | { 65 | // Not ready for input. 66 | penalty++; 67 | 68 | return 255; 69 | } 70 | }, 71 | (b) => 72 | { 73 | _console.Append((char)b); 74 | }); 75 | _bf.Run(_maxIterationCount); 76 | } 77 | catch 78 | { 79 | } 80 | 81 | _output.Append(_console.ToString()); 82 | _output.Append(","); 83 | 84 | // Order bonus. 85 | for (int j = 0; j < trainingExamples[i].Length; j++) 86 | { 87 | if (_console.Length > j) 88 | { 89 | Fitness += 256 - Math.Abs((byte)_console[j] - trainingExamples[i][j]); 90 | } 91 | } 92 | 93 | // Make the AI wait until a solution is found without the penalty (too many input characters). 94 | Fitness -= penalty; 95 | 96 | // Check for solution. 97 | IsFitnessAchieved(); 98 | 99 | // Bonus for less operations to optimize the code. 100 | countBonus += ((_maxIterationCount - _bf.m_Ticks) / 20.0); 101 | 102 | Ticks += _bf.m_Ticks; 103 | } 104 | 105 | if (_fitness != Double.MaxValue) 106 | { 107 | _fitness = Fitness + countBonus; 108 | } 109 | 110 | return _fitness; 111 | } 112 | 113 | protected override void RunProgramMethod(string program) 114 | { 115 | for (int i = 0; i < 99; i++) 116 | { 117 | // Get input from the user. 118 | Console.WriteLine(); 119 | Console.Write(">: "); 120 | byte startingValue = Byte.Parse(Console.ReadLine()); 121 | int index = 0; 122 | 123 | _console.Clear(); 124 | 125 | try 126 | { 127 | // Run the program. 128 | Interpreter bf = new Interpreter(program, () => 129 | { 130 | byte b; 131 | 132 | // Send the next character. 133 | if (index++ == 0) 134 | { 135 | b = startingValue; 136 | } 137 | else 138 | { 139 | b = 255; 140 | } 141 | 142 | return b; 143 | }, 144 | (b) => 145 | { 146 | // Append numeric byte value. 147 | _console.Append(b); 148 | }); 149 | 150 | bf.Run(_maxIterationCount); 151 | } 152 | catch 153 | { 154 | } 155 | 156 | Console.WriteLine(_console); 157 | } 158 | } 159 | 160 | public override string GetConstructorParameters() 161 | { 162 | return _maxIterationCount + ", " + _trainingCount; 163 | } 164 | 165 | #endregion 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Concrete/InnerTextFitness.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Base; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using Newtonsoft.Json; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Xml; 10 | 11 | namespace AIProgrammer.Fitness.Concrete 12 | { 13 | /// 14 | /// Outputs the text inside HTML (see trainingExamples). Use with genomeSize = 100. 15 | /// 16 | public class InnerTextFitness : FitnessBase 17 | { 18 | private static string[] _trainingExamples = { "i", "at", "

you

", "she", "p", "t" }; 19 | private static string[] _trainingResults = new string[_trainingExamples.Length]; 20 | 21 | public InnerTextFitness(GA ga, int maxIterationCount, string appendFunctions = null) 22 | : base(ga, maxIterationCount, appendFunctions) 23 | { 24 | if (_targetFitness == 0) 25 | { 26 | for (int i = 0; i < _trainingExamples.Length; i++) 27 | { 28 | XmlDocument doc = new XmlDocument(); 29 | doc.LoadXml(_trainingExamples[i]); 30 | _trainingResults[i] = doc.InnerText; 31 | 32 | _targetFitness += _trainingResults[i].Length * 256; 33 | _targetFitness += 100; // length fitness 34 | } 35 | } 36 | } 37 | 38 | #region FitnessBase Members 39 | 40 | protected override double GetFitnessMethod(string program) 41 | { 42 | double countBonus = 0; 43 | double penalty = 0; 44 | 45 | for (int i = 0; i < _trainingExamples.Length; i++) 46 | { 47 | try 48 | { 49 | int state = 0; 50 | _console.Clear(); 51 | 52 | // Run the program. 53 | _bf = new Interpreter(program, () => 54 | { 55 | if (state < _trainingExamples[i].Length) 56 | { 57 | // Send input. 58 | return (byte)_trainingExamples[i][state++]; 59 | } 60 | else 61 | { 62 | // Not ready for input. 63 | return 0; 64 | } 65 | }, 66 | (b) => 67 | { 68 | _console.Append((char)b); 69 | }); 70 | _bf.Run(_maxIterationCount); 71 | } 72 | catch 73 | { 74 | } 75 | 76 | _output.Append(_console.ToString()); 77 | _output.Append("|"); 78 | 79 | // Check result. 80 | for (int j = 0; j < _trainingResults[i].Length; j++) 81 | { 82 | if (_console.Length > j) 83 | { 84 | Fitness += 256 - Math.Abs(_console[j] - _trainingResults[i][j]); 85 | } 86 | } 87 | 88 | // Length bonus (percentage of 100). 89 | Fitness += 100 * ((_trainingResults[i].Length - Math.Abs(_console.Length - _trainingResults[i].Length)) / _trainingResults[i].Length); 90 | 91 | // Make the AI wait until a solution is found without the penalty. 92 | Fitness -= penalty; 93 | 94 | // Check for solution. 95 | IsFitnessAchieved(); 96 | 97 | // Bonus for less operations to optimize the code. 98 | countBonus += ((_maxIterationCount - _bf.m_Ticks) / 20.0); 99 | 100 | Ticks += _bf.m_Ticks; 101 | } 102 | 103 | if (_fitness != Double.MaxValue) 104 | { 105 | _fitness = Fitness + countBonus; 106 | } 107 | 108 | return _fitness; 109 | } 110 | 111 | protected override void RunProgramMethod(string program) 112 | { 113 | for (int i = 0; i < 99; i++) 114 | { 115 | // Get input from the user. 116 | Console.WriteLine(); 117 | Console.Write(">: "); 118 | string line = Console.ReadLine(); 119 | int index = 0; 120 | 121 | _console.Clear(); 122 | 123 | try 124 | { 125 | // Run the program. 126 | Interpreter bf = new Interpreter(program, () => 127 | { 128 | byte b; 129 | 130 | // Send the next character. 131 | if (index < line.Length) 132 | { 133 | b = (byte)line[index++]; 134 | } 135 | else 136 | { 137 | b = 0; 138 | } 139 | 140 | return b; 141 | }, 142 | (b) => 143 | { 144 | _console.Append((char)b); 145 | }); 146 | 147 | bf.Run(_maxIterationCount); 148 | } 149 | catch 150 | { 151 | } 152 | 153 | Console.WriteLine(_console.ToString()); 154 | } 155 | } 156 | 157 | public override string GetConstructorParameters() 158 | { 159 | return _maxIterationCount.ToString(); 160 | } 161 | 162 | #endregion 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Concrete/LessThanEqualToFitness.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Base; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using AIProgrammer.Managers; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace AIProgrammer.Fitness.Concrete 11 | { 12 | /// 13 | /// Less than, Equal to, Greater than fitness. The user enters a number and the program outputs L if less than 3, E if equal to 3, G if greater than 3. 14 | /// 15 | public class LessThanEqualToFitness : FitnessBase 16 | { 17 | private int _trainingCount; 18 | 19 | public LessThanEqualToFitness(GA ga, int maxIterationCount, int maxTrainingCount = 5) 20 | : base(ga, maxIterationCount) 21 | { 22 | _trainingCount = maxTrainingCount; 23 | if (_targetFitness == 0) 24 | { 25 | _targetFitness = _trainingCount * 256; 26 | } 27 | } 28 | 29 | #region FitnessBase Members 30 | 31 | protected override double GetFitnessMethod(string program) 32 | { 33 | byte input1 = 0; 34 | int state = 0; 35 | double countBonus = 0; 36 | double penalty = 0; 37 | HashSet printCommandHash = new HashSet(); 38 | 39 | for (int i = 0; i < _trainingCount; i++) 40 | { 41 | input1 = (byte)(i + 1); 42 | 43 | try 44 | { 45 | state = 0; 46 | _console.Clear(); 47 | 48 | // Run the program. 49 | _bf = new Interpreter(program, () => 50 | { 51 | if (state == 0) 52 | { 53 | state++; 54 | return input1; 55 | } 56 | else 57 | { 58 | penalty += 10; 59 | return 0; 60 | } 61 | }, 62 | (b) => 63 | { 64 | // Record the instruction index being used for this print statement. 65 | if (!printCommandHash.Add(_bf.m_CurrentInstructionPointer)) 66 | { 67 | // This is kind of cheating, but we need to force diversity by decoupling the cases. Force them to use unique print statements, not used by any other case. 68 | penalty += 200; 69 | } 70 | 71 | _console.Append((char)b); 72 | 73 | if (state != 1) 74 | { 75 | penalty += 10; 76 | } 77 | }); 78 | _bf.Run(_maxIterationCount); 79 | } 80 | catch 81 | { 82 | } 83 | 84 | // Order bonus. 85 | if (_console.Length > 0) 86 | { 87 | _output.Append(_console.ToString()); 88 | _output.Append(","); 89 | 90 | string output1 = ""; 91 | if (input1 < 3) 92 | { 93 | output1 = "L"; 94 | } 95 | else if (input1 == 3) 96 | { 97 | output1 = "E"; 98 | } 99 | else 100 | { 101 | output1 = "G"; 102 | } 103 | 104 | // Order bonus. 105 | if (_console.Length >= output1.Length) 106 | { 107 | for (int j = 0; j < output1.Length; j++) 108 | { 109 | Fitness += 256 - Math.Abs(_console[j] - output1[j]); 110 | } 111 | } 112 | } 113 | 114 | // Check for solution. 115 | IsFitnessAchieved(); 116 | 117 | // Bonus for less operations to optimize the code. 118 | countBonus += ((_maxIterationCount - _bf.m_Ticks) / 200.0); 119 | 120 | Ticks += _bf.m_Ticks; 121 | } 122 | 123 | if (_fitness != Double.MaxValue) 124 | { 125 | _fitness = Fitness + countBonus - penalty; 126 | } 127 | 128 | return _fitness; 129 | } 130 | 131 | protected override void RunProgramMethod(string program) 132 | { 133 | for (int i = 0; i < 99; i++) 134 | { 135 | // Get input from the user. 136 | _console.Clear(); 137 | 138 | try 139 | { 140 | // Run the program. 141 | Interpreter bf = new Interpreter(program, () => 142 | { 143 | Console.WriteLine(); 144 | Console.Write(">: "); 145 | 146 | return Byte.Parse(Console.ReadLine()); 147 | }, 148 | (b) => 149 | { 150 | Console.Write((char)b); 151 | }); 152 | 153 | bf.Run(_maxIterationCount); 154 | } 155 | catch 156 | { 157 | } 158 | 159 | Console.WriteLine(); 160 | Console.WriteLine("Program Ended"); 161 | } 162 | } 163 | 164 | public override string GetConstructorParameters() 165 | { 166 | return _maxIterationCount + ", " + _trainingCount; 167 | } 168 | 169 | #endregion 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Concrete/LogicalAndFitness.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Base; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AIProgrammer.Fitness.Concrete 10 | { 11 | /// 12 | /// Performs a logical AND operation: 0, 0 = 0, 0, 1 = 0, 1, 0 = 0, 1, 1 = 1. 13 | /// Note, input and output is in byte format (ie. 49 = '1'). 14 | /// 15 | public class LogicalAndFitness : FitnessBase 16 | { 17 | private static byte[][] _trainingExamples = { new byte[] { 0, 0 }, new byte[] { 0, 1 }, new byte[] { 1, 0 }, new byte[] { 1, 1 } }; 18 | private static byte[] _trainingResults = { 0, 0, 0, 1 }; 19 | 20 | public LogicalAndFitness(GA ga, int maxIterationCount, string appendFunctions = null) 21 | : base(ga, maxIterationCount, appendFunctions) 22 | { 23 | if (_targetFitness == 0) 24 | { 25 | _targetFitness = _trainingResults.Length * 256; 26 | } 27 | } 28 | 29 | #region FitnessBase Members 30 | 31 | protected override double GetFitnessMethod(string program) 32 | { 33 | double countBonus = 0; 34 | double penalty = 0; 35 | 36 | for (int i = 0; i < _trainingExamples.Length; i++) 37 | { 38 | try 39 | { 40 | int state = 0; 41 | 42 | _console.Clear(); 43 | 44 | // Run the program. 45 | _bf = new Interpreter(program, () => 46 | { 47 | if (state < 2) 48 | { 49 | // Send input for number of characters to split on. 50 | return _trainingExamples[i][state++]; 51 | } 52 | else 53 | { 54 | // Not ready for input. 55 | return 255; 56 | } 57 | }, 58 | (b) => 59 | { 60 | _console.Append((char)b); 61 | }); 62 | _bf.Run(_maxIterationCount); 63 | } 64 | catch 65 | { 66 | } 67 | 68 | _output.Append(_console.Length > 0 ? ((byte)_console[0]).ToString() : _console.ToString()); // Display byte. 69 | _output.Append("|"); 70 | 71 | // Check result. 72 | if (_console.Length > 0) 73 | { 74 | Fitness += 256 - Math.Abs((byte)_console[0] - _trainingResults[i]); 75 | } 76 | 77 | // Penalty for extra output. 78 | penalty += Math.Abs(_console.Length - 1); 79 | 80 | // Make the AI wait until a solution is found without the penalty (too many input characters). 81 | Fitness -= penalty; 82 | } 83 | 84 | // Check for solution. 85 | IsFitnessAchieved(); 86 | 87 | // Bonus for less operations to optimize the code. 88 | countBonus += ((_maxIterationCount - _bf.m_Ticks) / 20.0); 89 | 90 | Ticks += _bf.m_Ticks; 91 | 92 | if (_fitness != Double.MaxValue) 93 | { 94 | _fitness = Fitness + countBonus; 95 | } 96 | 97 | return _fitness; 98 | } 99 | 100 | protected override void RunProgramMethod(string program) 101 | { 102 | for (int i = 0; i < 99; i++) 103 | { 104 | // Get input from the user. 105 | Console.WriteLine(); 106 | Console.Write("Input format [00, 01, 10, 11]: "); 107 | string line = Console.ReadLine(); 108 | int index = 0; 109 | 110 | _console.Clear(); 111 | 112 | try 113 | { 114 | // Run the program. 115 | Interpreter bf = new Interpreter(program, () => 116 | { 117 | byte b; 118 | 119 | // Send the next character. 120 | if (index < 2) 121 | { 122 | b = Byte.Parse(line[index++].ToString()); 123 | } 124 | else 125 | { 126 | b = 255; 127 | } 128 | 129 | return b; 130 | }, 131 | (b) => 132 | { 133 | _console.Append(b); 134 | }); 135 | 136 | bf.Run(_maxIterationCount); 137 | } 138 | catch 139 | { 140 | } 141 | 142 | Console.WriteLine(_console.ToString()); 143 | } 144 | } 145 | 146 | public override string GetConstructorParameters() 147 | { 148 | return _maxIterationCount.ToString(); 149 | } 150 | 151 | #endregion 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Concrete/LogicalOrFitness.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Base; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AIProgrammer.Fitness.Concrete 10 | { 11 | /// 12 | /// Performs a logical OR operation: 0, 0 = 0, 0, 1 = 1, 1, 0 = 1, 1, 1 = 1. 13 | /// Note, input and output is in byte format (ie. 49 = '1'). 14 | /// 15 | public class LogicalOrFitness : FitnessBase 16 | { 17 | private static byte[][] _trainingExamples = { new byte[] { 0, 0 }, new byte[] { 0, 1 }, new byte[] { 1, 0 }, new byte[] { 1, 1 } }; 18 | private static byte[] _trainingResults = { 0, 1, 1, 1 }; 19 | 20 | public LogicalOrFitness(GA ga, int maxIterationCount, string appendFunctions = null) 21 | : base(ga, maxIterationCount, appendFunctions) 22 | { 23 | if (_targetFitness == 0) 24 | { 25 | _targetFitness = _trainingResults.Length * 256; 26 | } 27 | } 28 | 29 | #region FitnessBase Members 30 | 31 | protected override double GetFitnessMethod(string program) 32 | { 33 | double countBonus = 0; 34 | double penalty = 0; 35 | 36 | for (int i = 0; i < _trainingExamples.Length; i++) 37 | { 38 | try 39 | { 40 | int state = 0; 41 | 42 | _console.Clear(); 43 | 44 | // Run the program. 45 | _bf = new Interpreter(program, () => 46 | { 47 | if (state < 2) 48 | { 49 | // Send input for number of characters to split on. 50 | return _trainingExamples[i][state++]; 51 | } 52 | else 53 | { 54 | // Not ready for input. 55 | return 255; 56 | } 57 | }, 58 | (b) => 59 | { 60 | _console.Append((char)b); 61 | }); 62 | _bf.Run(_maxIterationCount); 63 | } 64 | catch 65 | { 66 | } 67 | 68 | _output.Append(_console.Length > 0 ? ((byte)_console[0]).ToString() : _console.ToString()); // Display byte. 69 | _output.Append("|"); 70 | 71 | // Check result. 72 | if (_console.Length > 0) 73 | { 74 | Fitness += 256 - Math.Abs((byte)_console[0] - _trainingResults[i]); 75 | } 76 | 77 | // Penalty for extra output. 78 | penalty += Math.Abs(_console.Length - 1); 79 | 80 | // Make the AI wait until a solution is found without the penalty (too many input characters). 81 | Fitness -= penalty; 82 | } 83 | 84 | // Check for solution. 85 | IsFitnessAchieved(); 86 | 87 | // Bonus for less operations to optimize the code. 88 | countBonus += ((_maxIterationCount - _bf.m_Ticks) / 20.0); 89 | 90 | Ticks += _bf.m_Ticks; 91 | 92 | if (_fitness != Double.MaxValue) 93 | { 94 | _fitness = Fitness + countBonus; 95 | } 96 | 97 | return _fitness; 98 | } 99 | 100 | protected override void RunProgramMethod(string program) 101 | { 102 | for (int i = 0; i < 99; i++) 103 | { 104 | // Get input from the user. 105 | Console.WriteLine(); 106 | Console.Write("Input format [00, 01, 10, 11]: "); 107 | string line = Console.ReadLine(); 108 | int index = 0; 109 | 110 | _console.Clear(); 111 | 112 | try 113 | { 114 | // Run the program. 115 | Interpreter bf = new Interpreter(program, () => 116 | { 117 | byte b; 118 | 119 | // Send the next character. 120 | if (index < 2) 121 | { 122 | b = Byte.Parse(line[index++].ToString()); 123 | } 124 | else 125 | { 126 | b = 255; 127 | } 128 | 129 | return b; 130 | }, 131 | (b) => 132 | { 133 | _console.Append(b); 134 | }); 135 | 136 | bf.Run(_maxIterationCount); 137 | } 138 | catch 139 | { 140 | } 141 | 142 | Console.WriteLine(_console.ToString()); 143 | } 144 | } 145 | 146 | public override string GetConstructorParameters() 147 | { 148 | return _maxIterationCount.ToString(); 149 | } 150 | 151 | #endregion 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Concrete/LogicalXorFitness.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Base; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AIProgrammer.Fitness.Concrete 10 | { 11 | /// 12 | /// Performs a logical XOR operation: 0, 0 = 0, 0, 1 = 1, 1, 0 = 1, 1, 1 = 0. 13 | /// Note, input and output is in byte format (ie. 49 = '1'). 14 | /// 15 | public class LogicalXorFitness : FitnessBase 16 | { 17 | private static byte[][] _trainingExamples = { new byte[] { 0, 0 }, new byte[] { 0, 1 }, new byte[] { 1, 0 }, new byte[] { 1, 1 } }; 18 | private static byte[] _trainingResults = { 0, 1, 1, 0 }; 19 | 20 | public LogicalXorFitness(GA ga, int maxIterationCount, string appendFunctions = null) 21 | : base(ga, maxIterationCount, appendFunctions) 22 | { 23 | if (_targetFitness == 0) 24 | { 25 | _targetFitness = _trainingResults.Length * 256; 26 | } 27 | } 28 | 29 | #region FitnessBase Members 30 | 31 | protected override double GetFitnessMethod(string program) 32 | { 33 | double countBonus = 0; 34 | double penalty = 0; 35 | 36 | for (int i = 0; i < _trainingExamples.Length; i++) 37 | { 38 | try 39 | { 40 | int state = 0; 41 | 42 | _console.Clear(); 43 | 44 | // Run the program. 45 | _bf = new Interpreter(program, () => 46 | { 47 | if (state < 2) 48 | { 49 | // Send input for number of characters to split on. 50 | return _trainingExamples[i][state++]; 51 | } 52 | else 53 | { 54 | // Not ready for input. 55 | return 255; 56 | } 57 | }, 58 | (b) => 59 | { 60 | _console.Append((char)b); 61 | }); 62 | _bf.Run(_maxIterationCount); 63 | } 64 | catch 65 | { 66 | } 67 | 68 | _output.Append(_console.Length > 0 ? ((byte)_console[0]).ToString() : _console.ToString()); // Display byte. 69 | _output.Append("|"); 70 | 71 | // Check result. 72 | if (_console.Length > 0) 73 | { 74 | Fitness += 256 - Math.Abs((byte)_console[0] - _trainingResults[i]); 75 | } 76 | 77 | // Penalty for extra output. 78 | penalty += Math.Abs(_console.Length - 1); 79 | 80 | // Make the AI wait until a solution is found without the penalty (too many input characters). 81 | Fitness -= penalty; 82 | } 83 | 84 | // Check for solution. 85 | IsFitnessAchieved(); 86 | 87 | // Bonus for less operations to optimize the code. 88 | countBonus += ((_maxIterationCount - _bf.m_Ticks) / 20.0); 89 | 90 | Ticks += _bf.m_Ticks; 91 | 92 | if (_fitness != Double.MaxValue) 93 | { 94 | _fitness = Fitness + countBonus; 95 | } 96 | 97 | return _fitness; 98 | } 99 | 100 | protected override void RunProgramMethod(string program) 101 | { 102 | for (int i = 0; i < 99; i++) 103 | { 104 | // Get input from the user. 105 | Console.WriteLine(); 106 | Console.Write("Input format [00, 01, 10, 11]: "); 107 | string line = Console.ReadLine(); 108 | int index = 0; 109 | 110 | _console.Clear(); 111 | 112 | try 113 | { 114 | // Run the program. 115 | Interpreter bf = new Interpreter(program, () => 116 | { 117 | byte b; 118 | 119 | // Send the next character. 120 | if (index < 2) 121 | { 122 | b = Byte.Parse(line[index++].ToString()); 123 | } 124 | else 125 | { 126 | b = 255; 127 | } 128 | 129 | return b; 130 | }, 131 | (b) => 132 | { 133 | _console.Append(b); 134 | }); 135 | 136 | bf.Run(_maxIterationCount); 137 | } 138 | catch 139 | { 140 | } 141 | 142 | Console.WriteLine(_console.ToString()); 143 | } 144 | } 145 | 146 | public override string GetConstructorParameters() 147 | { 148 | return _maxIterationCount.ToString(); 149 | } 150 | 151 | #endregion 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Concrete/ReverseStringFitness.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Base; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using AIProgrammer.Managers; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace AIProgrammer.Fitness.Concrete 11 | { 12 | /// 13 | /// Prints the reverse of the entered string. Prompts the user for input, one letter at a time, terminated by a zero. Then prints the text. 14 | /// 15 | public class ReverseStringFitness : FitnessBase 16 | { 17 | private int _trainingCount; 18 | 19 | public ReverseStringFitness(GA ga, int maxIterationCount, int maxTrainingCount = 5) 20 | : base(ga, maxIterationCount) 21 | { 22 | _trainingCount = maxTrainingCount; 23 | if (_targetFitness == 0) 24 | { 25 | for (int i=0; i<_trainingCount; i++) 26 | { 27 | _targetFitness += (i + 1) * 256; 28 | } 29 | } 30 | } 31 | 32 | #region FitnessBase Members 33 | 34 | protected override double GetFitnessMethod(string program) 35 | { 36 | string name = ""; 37 | int state = 0; 38 | double countBonus = 0; 39 | double penalty = 0; 40 | 41 | for (int i = 0; i < _trainingCount; i++) 42 | { 43 | switch (i) 44 | { 45 | case 0: name = "s"; break; 46 | case 1: name = "me"; break; 47 | case 2: name = "jay"; break; 48 | case 3: name = "kory"; break; 49 | case 4: name = "jamie"; break; 50 | }; 51 | 52 | try 53 | { 54 | state = 0; 55 | _console.Clear(); 56 | 57 | // Run the program. 58 | _bf = new Interpreter(program, () => 59 | { 60 | if (state < name.Length + 1) 61 | { 62 | if (state < name.Length) 63 | { 64 | // Send input. 65 | return (byte)name[state++]; 66 | } 67 | else 68 | { 69 | // Send terminator character. 70 | return 0; 71 | } 72 | } 73 | else 74 | { 75 | // Not ready for input. 76 | //penalty++; 77 | 78 | return 255; 79 | } 80 | }, 81 | (b) => 82 | { 83 | _console.Append((char)b); 84 | 85 | // Read result only after input has been entered. 86 | if (state < name.Length + 1) 87 | { 88 | // Not ready for output. 89 | //penalty++; 90 | } 91 | }); 92 | _bf.Run(_maxIterationCount); 93 | } 94 | catch 95 | { 96 | } 97 | 98 | _output.Append(_console.ToString()); 99 | _output.Append(","); 100 | 101 | // Order bonus. 102 | for (int j = 0; j < name.Length; j++) 103 | { 104 | if (_console.Length > j) 105 | { 106 | Fitness += 256 - Math.Abs(_console[j] - name[name.Length - j - 1]); 107 | } 108 | } 109 | 110 | // Make the AI wait until a solution is found without the penalty (too many input characters). 111 | Fitness -= penalty; 112 | 113 | // Check for solution. 114 | IsFitnessAchieved(); 115 | 116 | // Bonus for less operations to optimize the code. 117 | countBonus += ((_maxIterationCount - _bf.m_Ticks) / 20.0); 118 | 119 | Ticks += _bf.m_Ticks; 120 | } 121 | 122 | if (_fitness != Double.MaxValue) 123 | { 124 | _fitness = Fitness + countBonus; 125 | } 126 | 127 | return _fitness; 128 | } 129 | 130 | protected override void RunProgramMethod(string program) 131 | { 132 | for (int i = 0; i < 99; i++) 133 | { 134 | // Get input from the user. 135 | Console.WriteLine(); 136 | Console.Write(">: "); 137 | string line = Console.ReadLine(); 138 | int index = 0; 139 | 140 | _console.Clear(); 141 | 142 | try 143 | { 144 | // Run the program. 145 | Interpreter bf = new Interpreter(program, () => 146 | { 147 | byte b; 148 | 149 | // Send the next character. 150 | if (index < line.Length) 151 | { 152 | b = (byte)line[index++]; 153 | } 154 | else 155 | { 156 | b = 0; 157 | } 158 | 159 | return b; 160 | }, 161 | (b) => 162 | { 163 | _console.Append((char)b); 164 | }); 165 | 166 | bf.Run(_maxIterationCount); 167 | } 168 | catch 169 | { 170 | } 171 | 172 | Console.WriteLine(_console.ToString()); 173 | } 174 | } 175 | 176 | public override string GetConstructorParameters() 177 | { 178 | return _maxIterationCount + ", " + _trainingCount; 179 | } 180 | 181 | #endregion 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Concrete/StringFitness.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Base; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AIProgrammer.Fitness.Concrete 10 | { 11 | /// 12 | /// Displays a string in the console. 13 | /// 14 | public class StringFitness : FitnessBase 15 | { 16 | private string _targetString; 17 | 18 | public StringFitness(GA ga, int maxIterationCount, string targetString) 19 | : base(ga, maxIterationCount) 20 | { 21 | _targetString = targetString; 22 | if (_targetFitness == 0) 23 | { 24 | _targetFitness = _targetString.Length * 256; 25 | } 26 | } 27 | 28 | #region FitnessBase Members 29 | 30 | protected override double GetFitnessMethod(string program) 31 | { 32 | // Run the source code. 33 | Output = RunProgram(program); 34 | 35 | // Order bonus. 36 | for (int i = 0; i < _targetString.Length; i++) 37 | { 38 | if (_console.Length > i) 39 | { 40 | Fitness += 256 - Math.Abs(_console[i] - _targetString[i]); 41 | } 42 | } 43 | 44 | _fitness += Fitness; 45 | 46 | // Check for solution. 47 | IsFitnessAchieved(); 48 | 49 | Ticks = _bf.m_Ticks; 50 | 51 | return _fitness; 52 | } 53 | 54 | protected override void RunProgramMethod(string program) 55 | { 56 | try 57 | { 58 | // Run the program. 59 | _bf = new Interpreter(program, null, (b) => 60 | { 61 | _console.Append((char)b); 62 | }); 63 | 64 | _bf.Run(_maxIterationCount); 65 | } 66 | catch 67 | { 68 | } 69 | } 70 | 71 | public override string GetConstructorParameters() 72 | { 73 | return _maxIterationCount + ", \"" + _targetString + "\""; 74 | } 75 | 76 | #endregion 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Concrete/StringOptimizedFitness.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Base; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AIProgrammer.Fitness.Concrete 10 | { 11 | /// 12 | /// Displays a string in the console, with minimum number of instructions (optimized code). 13 | /// 14 | public class StringOptimizedFitness : FitnessBase 15 | { 16 | private string _targetString; 17 | 18 | public StringOptimizedFitness(GA ga, int maxIterationCount, string targetString) 19 | : base(ga, maxIterationCount) 20 | { 21 | _targetString = targetString; 22 | if (_targetFitness == 0) 23 | { 24 | _targetFitness = _targetString.Length * 256; 25 | } 26 | } 27 | 28 | #region FitnessBase Members 29 | 30 | protected override double GetFitnessMethod(string program) 31 | { 32 | // Run the source code. 33 | Output = RunProgram(program); 34 | 35 | // Order bonus. 36 | for (int i = 0; i < _targetString.Length; i++) 37 | { 38 | if (_console.Length > i) 39 | { 40 | Fitness += 256 - Math.Abs(_console[i] - _targetString[i]); 41 | } 42 | } 43 | 44 | _fitness += Fitness; 45 | 46 | // Check for solution. 47 | if (!IsFitnessAchieved()) 48 | { 49 | // Bonus for less operations to optimize the code. 50 | _fitness += ((_maxIterationCount - _bf.m_Ticks) / 20.0); 51 | } 52 | 53 | Ticks = _bf.m_Ticks; 54 | 55 | return _fitness; 56 | } 57 | 58 | protected override void RunProgramMethod(string program) 59 | { 60 | try 61 | { 62 | // Run the program. 63 | _bf = new Interpreter(program, null, (b) => 64 | { 65 | _console.Append((char)b); 66 | }); 67 | 68 | _bf.Run(_maxIterationCount); 69 | } 70 | catch 71 | { 72 | } 73 | } 74 | 75 | public override string GetConstructorParameters() 76 | { 77 | return _maxIterationCount + ", \"" + _targetString + "\""; 78 | } 79 | 80 | #endregion 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Concrete/StringStrictFitness.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Base; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AIProgrammer.Fitness.Concrete 10 | { 11 | /// 12 | /// Displays a string in the console, with minimum number of instructions (optimized code) and exact length, with no program errors. 13 | /// 14 | public class StringStrictFitness : FitnessBase 15 | { 16 | private string _targetString; 17 | 18 | public StringStrictFitness(GA ga, int maxIterationCount, string targetString, string appendFunctions = null) 19 | : base(ga, maxIterationCount, appendFunctions) 20 | { 21 | _targetString = targetString; 22 | 23 | if (_targetFitness == 0) 24 | { 25 | _targetFitness = _targetString.Length * 256; 26 | _targetFitness += 10; 27 | } 28 | } 29 | 30 | #region FitnessBase Members 31 | 32 | protected override double GetFitnessMethod(string program) 33 | { 34 | // Run the source code. 35 | try 36 | { 37 | // Run the program. 38 | _bf = new Interpreter(program, null, (b) => 39 | { 40 | _console.Append((char)b); 41 | }); 42 | 43 | _bf.Run(_maxIterationCount); 44 | } 45 | catch 46 | { 47 | Fitness--; 48 | } 49 | 50 | Output = _console.ToString(); 51 | 52 | // Order bonus. 53 | for (int i = 0; i < _targetString.Length; i++) 54 | { 55 | if (_console.Length > i) 56 | { 57 | Fitness += 256 - Math.Abs(_console[i] - _targetString[i]); 58 | } 59 | } 60 | 61 | // Length bonus (percentage of 100). 62 | Fitness += 10 * ((_targetString.Length - Math.Abs(_console.Length - _targetString.Length)) / _targetString.Length); 63 | 64 | _fitness += Fitness; 65 | 66 | // Check for solution. 67 | if (!IsFitnessAchieved()) 68 | { 69 | // Bonus for less operations to optimize the code. 70 | _fitness += ((_maxIterationCount - _bf.m_Ticks) / 20.0); 71 | } 72 | 73 | Ticks = _bf.m_Ticks; 74 | 75 | return _fitness; 76 | } 77 | 78 | protected override void RunProgramMethod(string program) 79 | { 80 | try 81 | { 82 | // Run the program. 83 | _bf = new Interpreter(program, null, (b) => 84 | { 85 | _console.Append((char)b); 86 | }); 87 | 88 | _bf.Run(_maxIterationCount); 89 | } 90 | catch 91 | { 92 | } 93 | } 94 | 95 | public override string GetConstructorParameters() 96 | { 97 | return _maxIterationCount + ", \"" + _targetString + "\""; 98 | } 99 | 100 | #endregion 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Concrete/SubtractFitness.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Base; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using AIProgrammer.Managers; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace AIProgrammer.Fitness.Concrete 11 | { 12 | /// 13 | /// Calculates the subtraction of various input integers and outputs the result as byte values (ie., 3 => 3, you would need to do a ToString() to display it on the console). 14 | /// 15 | public class SubtractFitness : FitnessBase 16 | { 17 | private int _trainingCount; 18 | 19 | public SubtractFitness(GA ga, int maxIterationCount, int maxTrainingCount = 5) 20 | : base(ga, maxIterationCount) 21 | { 22 | _trainingCount = maxTrainingCount; 23 | if (_targetFitness == 0) 24 | { 25 | _targetFitness = _trainingCount * 256; 26 | } 27 | } 28 | 29 | #region FitnessBase Members 30 | 31 | protected override double GetFitnessMethod(string program) 32 | { 33 | byte input1 = 0, input2 = 0; 34 | int state = 0; 35 | double countBonus = 0; 36 | 37 | for (int i = 0; i < _trainingCount; i++) 38 | { 39 | switch (i) 40 | { 41 | case 0: input1 = 9; input2 = 8; break; 42 | case 1: input1 = 6; input2 = 3; break; 43 | case 2: input1 = 4; input2 = 2; break; 44 | case 3: input1 = 5; input2 = 1; break; 45 | case 4: input1 = 7; input2 = 2; break; 46 | }; 47 | 48 | try 49 | { 50 | state = 0; 51 | _console.Clear(); 52 | 53 | // Run the program. 54 | _bf = new Interpreter(program, () => 55 | { 56 | if (state == 0) 57 | { 58 | state++; 59 | return input1; 60 | } 61 | else if (state == 1) 62 | { 63 | state++; 64 | return input2; 65 | } 66 | else 67 | { 68 | return 0; 69 | } 70 | }, 71 | (b) => 72 | { 73 | _console.Append(b.ToString()); 74 | }); 75 | _bf.Run(_maxIterationCount); 76 | } 77 | catch 78 | { 79 | } 80 | 81 | // Order bonus. 82 | if (_console.Length > 0) 83 | { 84 | _output.Append(_console.ToString()); 85 | _output.Append(","); 86 | 87 | int value; 88 | if (Int32.TryParse(_console.ToString(), out value)) 89 | { 90 | Fitness += 256 - Math.Abs(value - (input1 - input2)); 91 | } 92 | } 93 | 94 | // Check for solution. 95 | IsFitnessAchieved(); 96 | 97 | // Bonus for less operations to optimize the code. 98 | countBonus += ((_maxIterationCount - _bf.m_Ticks) / 1000.0); 99 | 100 | Ticks += _bf.m_Ticks; 101 | } 102 | 103 | if (_fitness != Double.MaxValue) 104 | { 105 | _fitness = Fitness + countBonus; 106 | } 107 | 108 | return _fitness; 109 | } 110 | 111 | protected override void RunProgramMethod(string program) 112 | { 113 | for (int i = 0; i < 99; i++) 114 | { 115 | try 116 | { 117 | int state = 0; 118 | 119 | // Run the program. 120 | Interpreter bf = new Interpreter(program, () => 121 | { 122 | if (state == 0) 123 | { 124 | state++; 125 | Console.WriteLine(); 126 | Console.Write(">: "); 127 | byte b = Byte.Parse(Console.ReadLine()); 128 | return b; 129 | } 130 | else if (state == 1) 131 | { 132 | state++; 133 | Console.WriteLine(); 134 | Console.Write(">: "); 135 | byte b = Byte.Parse(Console.ReadLine()); 136 | return b; 137 | } 138 | else 139 | { 140 | return 0; 141 | } 142 | }, 143 | (b) => 144 | { 145 | Console.Write(b.ToString()); 146 | }); 147 | 148 | bf.Run(_maxIterationCount); 149 | } 150 | catch 151 | { 152 | } 153 | } 154 | } 155 | 156 | public override string GetConstructorParameters() 157 | { 158 | return _maxIterationCount + ", " + _trainingCount; 159 | } 160 | 161 | #endregion 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /AIProgrammer.Fitness/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AIProgrammer.Fitness")] 9 | [assembly: AssemblyDescription("AIProgrammer.Fitness")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AIProgrammer.Fitness")] 13 | [assembly: AssemblyCopyright("Copyright © 2015 Kory Becker")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d7f1832f-a400-44b7-bc96-03983de44c6e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AIProgrammer.Functions/AIProgrammer.Functions.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D1CE7F4D-5142-4FC9-A35B-89F0EDAA2936} 8 | Library 9 | Properties 10 | AIProgrammer.Functions 11 | AIProgrammer.Functions 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | {2fa2525f-4faa-45a6-8268-4d561f7c46f9} 49 | AIProgrammer.Fitness 50 | 51 | 52 | {8ec97de8-ddfd-437a-b216-91db8d1a3487} 53 | AIProgrammer.GeneticAlgorithm 54 | 55 | 56 | {06d57f9c-a784-433f-8ff3-0728fecf6f5c} 57 | AIProgrammer.Managers 58 | 59 | 60 | {7bcc43b1-33a8-44c8-8f4d-752d89672180} 61 | AIProgrammer.Types 62 | 63 | 64 | 65 | 72 | -------------------------------------------------------------------------------- /AIProgrammer.Functions/Concrete/StringFunction.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Concrete; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using AIProgrammer.Managers; 4 | using AIProgrammer.Types; 5 | using AIProgrammer.Types.Interface; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace AIProgrammer.Functions.Concrete 13 | { 14 | public class StringFunction : IFunction 15 | { 16 | private Func _getFitnessFunc; 17 | private GAStatus _bestStatus; 18 | private double _crossoverRate; 19 | private double _mutationRate; 20 | private int _genomeSize; 21 | private GAFunction _fitnessFunc; 22 | private Action _onStepComplete; 23 | private OnGeneration _generationFunc; 24 | private TargetParams _targetParams; 25 | 26 | public StringFunction(Func getFitnessMethod, Action onStepComplete, GAStatus bestStatus, GAFunction fitnessFunc, OnGeneration generationFunc, double crossoverRate, double mutationRate, int genomeSize, TargetParams targetParams) 27 | { 28 | _getFitnessFunc = getFitnessMethod; 29 | _onStepComplete = onStepComplete; 30 | _bestStatus = bestStatus; 31 | _crossoverRate = crossoverRate; 32 | _mutationRate = mutationRate; 33 | _genomeSize = genomeSize; 34 | _fitnessFunc = fitnessFunc; 35 | _generationFunc = generationFunc; 36 | _targetParams = targetParams; 37 | } 38 | 39 | #region IFunction Members 40 | 41 | public string Generate(IGeneticAlgorithm ga) 42 | { 43 | // Generate functions. 44 | IFitness myFitness; 45 | string originalTargetString = _targetParams.TargetString; 46 | string program; 47 | string appendCode = ""; 48 | 49 | // Split string into terms. 50 | string[] parts = _targetParams.TargetString.Split(new char[] { ' ' }); 51 | 52 | // Build corpus of unique terms to generate functions. 53 | Dictionary terms = new Dictionary(); 54 | foreach (string part in parts) 55 | { 56 | if (!string.IsNullOrEmpty(part)) 57 | { 58 | terms[part] = part; 59 | } 60 | } 61 | 62 | foreach (string term in terms.Values) 63 | { 64 | _targetParams.TargetString = term; 65 | 66 | // Get the target fitness for this method. 67 | myFitness = _getFitnessFunc(); 68 | 69 | _targetParams.TargetFitness = myFitness.TargetFitness; 70 | 71 | // Run the genetic algorithm and get the best brain. 72 | program = GAManager.Run(ga, _fitnessFunc, _generationFunc); 73 | 74 | // Trim extraneous loop instructions from the end. 75 | program = program.Replace("[]", ""); 76 | 77 | appendCode += program + "@"; 78 | 79 | // Reset the target fitness. 80 | myFitness.ResetTargetFitness(); 81 | _bestStatus.Fitness = 0; 82 | _bestStatus.TrueFitness = 0; 83 | _bestStatus.Output = ""; 84 | _bestStatus.LastChangeDate = DateTime.Now; 85 | _bestStatus.Program = ""; 86 | _bestStatus.Ticks = 0; 87 | 88 | // Notify parent of progress. 89 | _onStepComplete(appendCode, term); 90 | } 91 | 92 | // Restore target string. 93 | _targetParams.TargetString = originalTargetString; 94 | 95 | return appendCode; 96 | } 97 | 98 | #endregion 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /AIProgrammer.Functions/Concrete/StringFunctionChunk.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.Fitness.Concrete; 2 | using AIProgrammer.GeneticAlgorithm; 3 | using AIProgrammer.Managers; 4 | using AIProgrammer.Types; 5 | using AIProgrammer.Types.Interface; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace AIProgrammer.Functions.Concrete 13 | { 14 | /// 15 | /// Same as StringFunction (which splits a string into terms separated by spaces for solving by the GA), but this one splits every N characters instead. 16 | /// Useful for fast generation of longer words, by splitting every x characters. It's recommended to use at least 4-character chunks to add enough value for the GA to select these functions. 17 | /// Usage: 18 | /// private static int _genomeSize = 30; 19 | /// private static IFunction _functionGenerator = new StringFunctionChunk(() => GetFitnessMethod(), _bestStatus, fitnessFunction, OnGeneration, _crossoverRate, _mutationRate, _genomeSize, _targetParams, 4); 20 | /// ... 21 | /// private static IFitness GetFitnessMethod() 22 | /// { 23 | /// return new StringStrictFitness(_ga, _maxIterationCount, _targetParams.TargetString, _appendCode); 24 | /// } 25 | /// 26 | public class StringFunctionChunk : IFunction 27 | { 28 | private Func _getFitnessFunc; 29 | private GAStatus _bestStatus; 30 | private double _crossoverRate; 31 | private double _mutationRate; 32 | private int _genomeSize; 33 | private GAFunction _fitnessFunc; 34 | private Action _onStepComplete; 35 | private OnGeneration _generationFunc; 36 | private TargetParams _targetParams; 37 | private int _chunkSize; 38 | 39 | public StringFunctionChunk(Func getFitnessMethod, Action onStepComplete, GAStatus bestStatus, GAFunction fitnessFunc, OnGeneration generationFunc, double crossoverRate, double mutationRate, int genomeSize, TargetParams targetParams, int chunkSize = 4) 40 | { 41 | _getFitnessFunc = getFitnessMethod; 42 | _onStepComplete = onStepComplete; 43 | _bestStatus = bestStatus; 44 | _crossoverRate = crossoverRate; 45 | _mutationRate = mutationRate; 46 | _genomeSize = genomeSize; 47 | _fitnessFunc = fitnessFunc; 48 | _generationFunc = generationFunc; 49 | _targetParams = targetParams; 50 | 51 | _chunkSize = chunkSize; 52 | } 53 | 54 | /// 55 | /// http://stackoverflow.com/a/4133475/2596404 56 | /// 57 | private IEnumerable SplitInParts(string s, int partLength) 58 | { 59 | if (s == null) 60 | { 61 | throw new ArgumentNullException("s"); 62 | } 63 | if (partLength <= 0) 64 | { 65 | throw new ArgumentException("Part length has to be positive.", "partLength"); 66 | } 67 | 68 | for (var i = 0; i < s.Length; i += partLength) 69 | { 70 | yield return s.Substring(i, Math.Min(partLength, s.Length - i)); 71 | } 72 | } 73 | 74 | #region IFunction Members 75 | 76 | public string Generate(IGeneticAlgorithm ga) 77 | { 78 | // Generate functions. 79 | IFitness myFitness; 80 | string originalTargetString = _targetParams.TargetString; 81 | string program; 82 | string appendCode = ""; 83 | 84 | // Split string into terms of 3-characters. 85 | string[] parts = SplitInParts(_targetParams.TargetString, _chunkSize).ToArray(); 86 | 87 | // Build corpus of unique terms to generate functions. 88 | Dictionary terms = new Dictionary(); 89 | foreach (string part in parts) 90 | { 91 | terms[part] = part; 92 | } 93 | 94 | foreach (string term in terms.Values) 95 | { 96 | _targetParams.TargetString = term; 97 | 98 | // Get the target fitness for this method. 99 | myFitness = _getFitnessFunc(); 100 | 101 | _targetParams.TargetFitness = myFitness.TargetFitness; 102 | 103 | // Run the genetic algorithm and get the best brain. 104 | program = GAManager.Run(ga, _fitnessFunc, _generationFunc); 105 | 106 | // Trim extraneous loop instructions from the end. 107 | program = program.Replace("[]", ""); 108 | 109 | appendCode += program + "@"; 110 | 111 | // Reset the target fitness. 112 | myFitness.ResetTargetFitness(); 113 | _bestStatus.Fitness = 0; 114 | _bestStatus.TrueFitness = 0; 115 | _bestStatus.Output = ""; 116 | _bestStatus.LastChangeDate = DateTime.Now; 117 | _bestStatus.Program = ""; 118 | _bestStatus.Ticks = 0; 119 | 120 | // Notify parent of progress. 121 | _onStepComplete(appendCode, term); 122 | } 123 | 124 | // Restore target string. 125 | _targetParams.TargetString = originalTargetString; 126 | 127 | return appendCode; 128 | } 129 | 130 | #endregion 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /AIProgrammer.Functions/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AIProgrammer.Functions")] 9 | [assembly: AssemblyDescription("AIProgrammer.Functions")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AIProgrammer.Functions")] 13 | [assembly: AssemblyCopyright("Copyright © 2015 Kory Becker")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a42d0aed-3cc1-42dd-b232-4bb1c3d45cd2")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AIProgrammer.GA/AIProgrammer.GeneticAlgorithm.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8EC97DE8-DDFD-437A-B216-91DB8D1A3487} 8 | Library 9 | Properties 10 | AIProgrammer.GeneticAlgorithm 11 | AIProgrammer.GeneticAlgorithm 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | {bd558a71-1699-440f-9876-19322e658e88} 49 | AIProgrammer.Repository 50 | 51 | 52 | {7bcc43b1-33a8-44c8-8f4d-752d89672180} 53 | AIProgrammer.Types 54 | 55 | 56 | 57 | 64 | -------------------------------------------------------------------------------- /AIProgrammer.GA/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AIProgrammer.GA")] 9 | [assembly: AssemblyDescription("AIProgrammer.GA")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AIProgrammer.GA")] 13 | [assembly: AssemblyCopyright("Copyright © 2015 Kory Becker")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e6f98502-a098-4aba-8b45-9108a9e598b0")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AIProgrammer.Interpreter/AIProgrammer.Interpreter.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {4F4F1800-BE33-4D38-AD95-6835644C076E} 8 | Library 9 | Properties 10 | AIProgrammer.Interpreter 11 | AIProgrammer.Interpreter 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | {7BCC43B1-33A8-44C8-8F4D-752D89672180} 48 | AIProgrammer.Types 49 | 50 | 51 | 52 | 59 | -------------------------------------------------------------------------------- /AIProgrammer.Interpreter/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AIProgrammer.Interpreter")] 9 | [assembly: AssemblyDescription("AIProgrammer.Interpreter")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AIProgrammer.Interpreter")] 13 | [assembly: AssemblyCopyright("Copyright © 2015 Kory Becker")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7e0e96aa-5f07-4c2f-858e-2e24eb141c53")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AIProgrammer.Managers/AIProgrammer.Managers.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {06D57F9C-A784-433F-8FF3-0728FECF6F5C} 8 | Library 9 | Properties 10 | AIProgrammer.Managers 11 | AIProgrammer.Managers 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | {8ec97de8-ddfd-437a-b216-91db8d1a3487} 51 | AIProgrammer.GeneticAlgorithm 52 | 53 | 54 | {7bcc43b1-33a8-44c8-8f4d-752d89672180} 55 | AIProgrammer.Types 56 | 57 | 58 | 59 | 60 | 67 | -------------------------------------------------------------------------------- /AIProgrammer.Managers/GAManager.cs: -------------------------------------------------------------------------------- 1 | using AIProgrammer.GeneticAlgorithm; 2 | using AIProgrammer.Types.Interface; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace AIProgrammer.Managers 11 | { 12 | public static class GAManager 13 | { 14 | /// 15 | /// Setup the genetic algorithm and run it. 16 | /// 17 | /// Best brain's output source code 18 | public static string Run(IGeneticAlgorithm iga, GAFunction fitnessFunc, OnGeneration generationFunc, Action setupFunc = null, bool resume = false) 19 | { 20 | GA ga = (GA)iga; 21 | 22 | if (!resume) 23 | { 24 | if (setupFunc != null) 25 | { 26 | // Perform any additional setup for this fitness. 27 | setupFunc(); 28 | } 29 | 30 | try 31 | { 32 | // Delete any existing dat file. 33 | File.Delete(Directory.GetCurrentDirectory() + "\\my-genetic-algorithm.dat"); 34 | } 35 | catch (Exception excep) 36 | { 37 | Console.WriteLine("Unable to delete " + Directory.GetCurrentDirectory() + "\\my-genetic-algorithm.dat\n" + excep.Message); 38 | } 39 | 40 | // Start a new genetic algorithm. 41 | ga.GAParams.Elitism = true; 42 | ga.GAParams.HistoryPath = Directory.GetCurrentDirectory() + "\\history.txt"; 43 | ga.FitnessFunction = new GAFunction(fitnessFunc); 44 | ga.OnGenerationFunction = new OnGeneration(generationFunc); 45 | ga.Go(); 46 | } 47 | else 48 | { 49 | // Load a saved genetic algorithm. 50 | ga.Load("my-genetic-algorithm.dat"); 51 | ga.Resume(fitnessFunc, generationFunc); 52 | } 53 | 54 | // Results. 55 | double[] weights; 56 | double fitness; 57 | ga.GetBest(out weights, out fitness); 58 | 59 | Console.WriteLine("***** DONE! *****"); 60 | 61 | return CommonManager.ConvertDoubleArrayToBF(weights); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /AIProgrammer.Managers/LogManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.Specialized; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AIProgrammer.Managers 10 | { 11 | public static class LogManager 12 | { 13 | /// 14 | /// Logs a message to the logging web service Loggly. 15 | /// 16 | /// string 17 | /// string 18 | /// Loggly API key 19 | public static string Log(string message, string tag, string logglyKey) 20 | { 21 | string result = ""; 22 | 23 | try 24 | { 25 | string url = "https://logs-01.loggly.com/inputs/" + logglyKey + "/tag/" + tag.Replace(" ", "_") + "/"; 26 | 27 | using (WebClient client = new WebClient()) 28 | { 29 | byte[] response = client.UploadValues(url, new NameValueCollection() { { "Message", message } }); 30 | result = Encoding.UTF8.GetString(response); 31 | } 32 | } 33 | catch (Exception ex) 34 | { 35 | result = ex.ToString(); 36 | } 37 | 38 | return result; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /AIProgrammer.Managers/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AIProgrammer.Managers")] 9 | [assembly: AssemblyDescription("AIProgrammer.Managers")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AIProgrammer.Managers")] 13 | [assembly: AssemblyCopyright("Copyright © 2015 Kory Becker")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a6f39ab8-4ee8-42da-8522-9bf180c09a47")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AIProgrammer.Repository/AIProgrammer.Repository.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {BD558A71-1699-440F-9876-19322E658E88} 8 | Library 9 | Properties 10 | AIProgrammer.Repository 11 | AIProgrammer.Repository 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | {d65cdc62-78ad-4ff7-b04a-e58b78e0b077} 49 | AIProgrammer.Database 50 | 51 | 52 | {7bcc43b1-33a8-44c8-8f4d-752d89672180} 53 | AIProgrammer.Types 54 | 55 | 56 | 57 | 64 | -------------------------------------------------------------------------------- /AIProgrammer.Repository/Concrete/GARepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using AIProgrammer.Repository.Interface; 4 | using AIProgrammer.Database.Interface; 5 | using AIProgrammer.Database.Concrete; 6 | using AIProgrammer.Types; 7 | using System.IO; 8 | 9 | namespace AIProgrammer.Repository.Concrete 10 | { 11 | public class GARepository : IRepository 12 | { 13 | private readonly string _filePath = Directory.GetCurrentDirectory() + "\\"; 14 | 15 | private List _items = new List(); 16 | private IDatabase _database; 17 | 18 | public GARepository(string fileName) 19 | { 20 | _database = new XmlDatabase(_filePath + fileName); 21 | 22 | // Load the _items database. 23 | LoadChanges(); 24 | } 25 | 26 | #region IRepository Members 27 | 28 | public IEnumerable GetAll() 29 | { 30 | return _items; 31 | } 32 | 33 | public void Delete(GAParams entity) 34 | { 35 | int index = FindIndexOfEntity(entity); 36 | if (index != -1) 37 | { 38 | _items.RemoveAt(index); 39 | } 40 | } 41 | 42 | public void Add(GAParams entity) 43 | { 44 | int index = FindIndexOfEntity(entity); 45 | if (index == -1) 46 | { 47 | // Insert 48 | _items.Add(entity); 49 | } 50 | else 51 | { 52 | // Update 53 | _items.RemoveAt(index); 54 | _items.Insert(index, entity); 55 | } 56 | } 57 | 58 | #endregion 59 | 60 | #region Database Methods 61 | 62 | private void LoadChanges() 63 | { 64 | _items = _database.ReadEntities(); 65 | } 66 | 67 | public void SaveChanges() 68 | { 69 | _database.WriteEntities(_items); 70 | } 71 | 72 | #endregion 73 | 74 | private int FindIndexOfEntity(GAParams ga) 75 | { 76 | int index = 0; 77 | 78 | if (ga != null) 79 | { 80 | foreach (GAParams obj in _items) 81 | { 82 | if (obj.CrossoverRate == ga.CrossoverRate && obj.Elitism == ga.Elitism && obj.GenomeSize == ga.GenomeSize && obj.MutationRate == ga.MutationRate && obj.PopulationSize == ga.PopulationSize && obj.TargetFitness == ga.TargetFitness) 83 | { 84 | return index; 85 | } 86 | 87 | index++; 88 | } 89 | } 90 | 91 | return -1; 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /AIProgrammer.Repository/Interface/IRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace AIProgrammer.Repository.Interface 7 | { 8 | public interface IRepository where T: class 9 | { 10 | IEnumerable GetAll(); 11 | void Delete(T entity); 12 | void Add(T entity); 13 | void SaveChanges(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /AIProgrammer.Repository/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AIProgrammer.Repository")] 9 | [assembly: AssemblyDescription("AIProgrammer.Repository")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AIProgrammer.Repository")] 13 | [assembly: AssemblyCopyright("Copyright © 2015 Kory Becker")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("ea357c4e-f477-41a7-a6d5-95585ace828c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AIProgrammer.Types/AIProgrammer.Types.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {7BCC43B1-33A8-44C8-8F4D-752D89672180} 8 | Library 9 | Properties 10 | AIProgrammer.Types 11 | AIProgrammer.Types 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 61 | -------------------------------------------------------------------------------- /AIProgrammer.Types/Function.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AIProgrammer.Types 8 | { 9 | /// 10 | /// Function specific settings. 11 | /// 12 | public class Function 13 | { 14 | /// 15 | /// Controls how functions read input (,) from parent memory: either at the current memory data pointer or from the start of memory. 16 | /// If true, input will be read from position 0 from the parent. Meaning, the first input value that the parent read will be the first input value the function gets, regardless of the parent's current memory data position. This may make it easier for the GA to run the function, since it does not require an exact memory position before calling the function. 17 | /// If false (default), input will be read from the current memory data position of the parent. Meaning, if the parent has shifted the memory pointer up 3 slots, the function will begin reading from memory at position 3. 18 | /// 19 | public bool ReadInputAtMemoryStart { get; set; } 20 | /// 21 | /// Custom max iteration counts for functions. 22 | /// 23 | public int MaxIterationCount { get; set; } 24 | 25 | public Function() 26 | { 27 | } 28 | 29 | public Function(Function function) 30 | : this() 31 | { 32 | if (function != null) 33 | { 34 | ReadInputAtMemoryStart = function.ReadInputAtMemoryStart; 35 | MaxIterationCount = function.MaxIterationCount; 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /AIProgrammer.Types/FunctionInst.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AIProgrammer.Types 8 | { 9 | /// 10 | /// Function specific settings for the interpreter. Includes the instruction pointer value. 11 | /// 12 | public class FunctionInst : Function 13 | { 14 | /// 15 | /// Starting instruction index for this function, within the program code. 16 | /// 17 | public int InstructionPointer { get; private set; } 18 | 19 | public FunctionInst(int instructionPointer, Function function) 20 | : base(function) 21 | { 22 | InstructionPointer = instructionPointer; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /AIProgrammer.Types/GAParams.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AIProgrammer.Types 8 | { 9 | [Serializable] 10 | public class GAParams 11 | { 12 | public int PopulationSize { get; set; } 13 | public int Generations { get; set; } 14 | public int GenomeSize { get; set; } 15 | public double CrossoverRate { get; set; } 16 | public double MutationRate { get; set; } 17 | public bool Elitism { get; set; } // Keep previous generation's fittest individual in place of worst in current 18 | public string HistoryPath { get; set; } // Path to save log of fitness history at each generation. Can be used to plot on Excel chart etc. 19 | 20 | public double TotalFitness { get; set; } 21 | public double TargetFitness { get; set; } 22 | public int TargetFitnessCount { get; set; } 23 | public int CurrentGeneration { get; set; } 24 | 25 | public List ThisGeneration { get; set; } 26 | public List NextGeneration { get; set; } 27 | public List FitnessTable { get; set; } 28 | 29 | public GAParams() 30 | { 31 | ThisGeneration = new List(); 32 | NextGeneration = new List(); 33 | FitnessTable = new List(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /AIProgrammer.Types/GAStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AIProgrammer.Types 8 | { 9 | public class GAStatus 10 | { 11 | /// 12 | /// Best fitness so far. 13 | /// 14 | public double Fitness = 0; 15 | /// 16 | /// Best true fitness so far, used to determine when a solution is found. 17 | /// 18 | public double TrueFitness = 0; 19 | /// 20 | /// Best program so far. 21 | /// 22 | public string Program = ""; 23 | /// 24 | /// Best program output so far. 25 | /// 26 | public string Output = ""; 27 | /// 28 | /// Current iteration (generation) count. 29 | /// 30 | public int Iteration = 0; 31 | /// 32 | /// Count of status prompts. 33 | /// 34 | public int StatusCount = 0; 35 | /// 36 | /// Number of instructions executed by the best program. 37 | /// 38 | public int Ticks = 0; 39 | /// 40 | /// Number of instructions executed by the best program, including function calls. 41 | /// 42 | public int TotalTicks = 0; 43 | /// 44 | /// Time of last improved evolution. 45 | /// 46 | public DateTime LastChangeDate = DateTime.Now; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /AIProgrammer.Types/Interface/IFitness.cs: -------------------------------------------------------------------------------- 1 | namespace AIProgrammer.Types.Interface 2 | { 3 | public interface IFitness 4 | { 5 | /// 6 | /// Program source code. 7 | /// 8 | string Program { get; set; } 9 | 10 | /// 11 | /// Program output, after running. 12 | /// 13 | string Output { get; set; } 14 | 15 | /// 16 | /// True fitness. This is the fitness used to determine when a solution is found. 17 | /// 18 | double Fitness { get; set; } 19 | 20 | /// 21 | /// Target fitness to achieve a solution. 22 | /// 23 | double TargetFitness { get; } 24 | 25 | /// 26 | /// Number of instructions executed for the best fitness. 27 | /// 28 | int Ticks { get; set; } 29 | 30 | /// 31 | /// Number of instructions executed for the best fitness, including function calls. 32 | /// 33 | int TotalTicks { get; set; } 34 | 35 | #region Settings 36 | 37 | /// 38 | /// Program code, containing functions, that will be appended to main program code. 39 | /// 40 | string AppendCode { get; } 41 | /// 42 | /// Percentage chance that a child genome will use crossover of two parents. Default 0.7 43 | /// 44 | double? CrossoverRate { get; } 45 | /// 46 | /// Percentage chance that a child genome will mutate a gene. Default 0.01 47 | /// 48 | double? MutationRate { get; } 49 | /// 50 | /// Number of programming instructions in generated program (size of genome array). loops). Default 100 51 | /// 52 | int? GenomeSize { get; } 53 | /// 54 | /// The max length a genome may grow to (only applicable if _expandAmount > 0). Default 100 55 | /// 56 | int? MaxGenomeSize { get; } 57 | /// 58 | /// Max iterations a program may run before being killed (prevents infinite loops). Default 5000 59 | /// 60 | int? MaxIterationCount { get; } 61 | /// 62 | /// The max genome size will expand by this amount, every _expandRate iterations (may help learning). Set to 0 to disable. Default 0 63 | /// 64 | int? ExpandAmount { get; } 65 | /// 66 | /// The max genome size will expand by _expandAmount, at this interval of generations. Default 5000 67 | /// 68 | int? ExpandRate { get; } 69 | 70 | #endregion 71 | 72 | /// 73 | /// Gets the fitness for the weights. Converts the weights into program code, executes the code, ranks the result. 74 | /// 75 | /// Array of double 76 | /// double 77 | double GetFitness(double[] weights); 78 | 79 | /// 80 | /// Runs the program source code and returns the output as a string for displaying to the user. Use this with the final result for the user. 81 | /// 82 | /// string 83 | /// string (output) 84 | string RunProgram(string program); 85 | 86 | /// 87 | /// Returns the compilation parameters required to instantiate the fitness constructor (not including GA). 88 | /// Examples: 89 | /// AddFitness: _maxIterationCount + ", " + _trainingCount 90 | /// StringFitness: _maxIterationCount + ", \"" + _targetString + "\"" 91 | /// HelloUserFitness: _maxIterationCount + ", \"" + _targetString + "\", " + _trainingCount 92 | /// 93 | /// 94 | string GetConstructorParameters(); 95 | 96 | /// 97 | /// Resets the target fitness to 0. 98 | /// 99 | void ResetTargetFitness(); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /AIProgrammer.Types/Interface/IFunction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AIProgrammer.Types.Interface 8 | { 9 | public interface IFunction 10 | { 11 | string Generate(IGeneticAlgorithm ga); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /AIProgrammer.Types/Interface/IGeneticAlgorithm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AIProgrammer.Types.Interface 8 | { 9 | public interface IGeneticAlgorithm 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /AIProgrammer.Types/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AIProgrammer.Types")] 9 | [assembly: AssemblyDescription("AIProgrammer.Types")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AIProgrammer.Types")] 13 | [assembly: AssemblyCopyright("Copyright © 2015 Kory Becker")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("5e05199e-420d-438b-a608-4f947b7f283c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AIProgrammer.Types/TargetParams.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace AIProgrammer.Types 8 | { 9 | public class TargetParams 10 | { 11 | public double TargetFitness { get; set; } 12 | public string TargetString { get; set; } 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /AIProgrammer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIProgrammer", "AIProgrammer\AIProgrammer.csproj", "{632DBA3A-BAF8-458F-9C3D-DDFACCBEAD8E}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIProgrammer.Database", "AIProgrammer.Database\AIProgrammer.Database.csproj", "{D65CDC62-78AD-4FF7-B04A-E58B78E0B077}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIProgrammer.GeneticAlgorithm", "AIProgrammer.GA\AIProgrammer.GeneticAlgorithm.csproj", "{8EC97DE8-DDFD-437A-B216-91DB8D1A3487}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIProgrammer.Interpreter", "AIProgrammer.Interpreter\AIProgrammer.Interpreter.csproj", "{4F4F1800-BE33-4D38-AD95-6835644C076E}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIProgrammer.Repository", "AIProgrammer.Repository\AIProgrammer.Repository.csproj", "{BD558A71-1699-440F-9876-19322E658E88}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIProgrammer.Types", "AIProgrammer.Types\AIProgrammer.Types.csproj", "{7BCC43B1-33A8-44C8-8F4D-752D89672180}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIProgrammer.Compiler", "AIProgrammer.Compiler\AIProgrammer.Compiler.csproj", "{5F99B6A4-5CB2-432B-8018-E2EDFBB957F7}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIProgrammer.Fitness", "AIProgrammer.Fitness\AIProgrammer.Fitness.csproj", "{2FA2525F-4FAA-45A6-8268-4D561F7C46F9}" 19 | EndProject 20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIProgrammer.Managers", "AIProgrammer.Managers\AIProgrammer.Managers.csproj", "{06D57F9C-A784-433F-8FF3-0728FECF6F5C}" 21 | EndProject 22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIProgrammer.Functions", "AIProgrammer.Functions\AIProgrammer.Functions.csproj", "{D1CE7F4D-5142-4FC9-A35B-89F0EDAA2936}" 23 | EndProject 24 | Global 25 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 26 | Debug|Any CPU = Debug|Any CPU 27 | Release|Any CPU = Release|Any CPU 28 | EndGlobalSection 29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 30 | {632DBA3A-BAF8-458F-9C3D-DDFACCBEAD8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {632DBA3A-BAF8-458F-9C3D-DDFACCBEAD8E}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {632DBA3A-BAF8-458F-9C3D-DDFACCBEAD8E}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {632DBA3A-BAF8-458F-9C3D-DDFACCBEAD8E}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {D65CDC62-78AD-4FF7-B04A-E58B78E0B077}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {D65CDC62-78AD-4FF7-B04A-E58B78E0B077}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {D65CDC62-78AD-4FF7-B04A-E58B78E0B077}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {D65CDC62-78AD-4FF7-B04A-E58B78E0B077}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {8EC97DE8-DDFD-437A-B216-91DB8D1A3487}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {8EC97DE8-DDFD-437A-B216-91DB8D1A3487}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {8EC97DE8-DDFD-437A-B216-91DB8D1A3487}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {8EC97DE8-DDFD-437A-B216-91DB8D1A3487}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {4F4F1800-BE33-4D38-AD95-6835644C076E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 43 | {4F4F1800-BE33-4D38-AD95-6835644C076E}.Debug|Any CPU.Build.0 = Debug|Any CPU 44 | {4F4F1800-BE33-4D38-AD95-6835644C076E}.Release|Any CPU.ActiveCfg = Release|Any CPU 45 | {4F4F1800-BE33-4D38-AD95-6835644C076E}.Release|Any CPU.Build.0 = Release|Any CPU 46 | {BD558A71-1699-440F-9876-19322E658E88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 47 | {BD558A71-1699-440F-9876-19322E658E88}.Debug|Any CPU.Build.0 = Debug|Any CPU 48 | {BD558A71-1699-440F-9876-19322E658E88}.Release|Any CPU.ActiveCfg = Release|Any CPU 49 | {BD558A71-1699-440F-9876-19322E658E88}.Release|Any CPU.Build.0 = Release|Any CPU 50 | {7BCC43B1-33A8-44C8-8F4D-752D89672180}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 51 | {7BCC43B1-33A8-44C8-8F4D-752D89672180}.Debug|Any CPU.Build.0 = Debug|Any CPU 52 | {7BCC43B1-33A8-44C8-8F4D-752D89672180}.Release|Any CPU.ActiveCfg = Release|Any CPU 53 | {7BCC43B1-33A8-44C8-8F4D-752D89672180}.Release|Any CPU.Build.0 = Release|Any CPU 54 | {5F99B6A4-5CB2-432B-8018-E2EDFBB957F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 55 | {5F99B6A4-5CB2-432B-8018-E2EDFBB957F7}.Debug|Any CPU.Build.0 = Debug|Any CPU 56 | {5F99B6A4-5CB2-432B-8018-E2EDFBB957F7}.Release|Any CPU.ActiveCfg = Release|Any CPU 57 | {5F99B6A4-5CB2-432B-8018-E2EDFBB957F7}.Release|Any CPU.Build.0 = Release|Any CPU 58 | {2FA2525F-4FAA-45A6-8268-4D561F7C46F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 59 | {2FA2525F-4FAA-45A6-8268-4D561F7C46F9}.Debug|Any CPU.Build.0 = Debug|Any CPU 60 | {2FA2525F-4FAA-45A6-8268-4D561F7C46F9}.Release|Any CPU.ActiveCfg = Release|Any CPU 61 | {2FA2525F-4FAA-45A6-8268-4D561F7C46F9}.Release|Any CPU.Build.0 = Release|Any CPU 62 | {06D57F9C-A784-433F-8FF3-0728FECF6F5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 63 | {06D57F9C-A784-433F-8FF3-0728FECF6F5C}.Debug|Any CPU.Build.0 = Debug|Any CPU 64 | {06D57F9C-A784-433F-8FF3-0728FECF6F5C}.Release|Any CPU.ActiveCfg = Release|Any CPU 65 | {06D57F9C-A784-433F-8FF3-0728FECF6F5C}.Release|Any CPU.Build.0 = Release|Any CPU 66 | {D1CE7F4D-5142-4FC9-A35B-89F0EDAA2936}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 67 | {D1CE7F4D-5142-4FC9-A35B-89F0EDAA2936}.Debug|Any CPU.Build.0 = Debug|Any CPU 68 | {D1CE7F4D-5142-4FC9-A35B-89F0EDAA2936}.Release|Any CPU.ActiveCfg = Release|Any CPU 69 | {D1CE7F4D-5142-4FC9-A35B-89F0EDAA2936}.Release|Any CPU.Build.0 = Release|Any CPU 70 | EndGlobalSection 71 | GlobalSection(SolutionProperties) = preSolution 72 | HideSolutionNode = FALSE 73 | EndGlobalSection 74 | EndGlobal 75 | -------------------------------------------------------------------------------- /AIProgrammer/AIProgrammer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {632DBA3A-BAF8-458F-9C3D-DDFACCBEAD8E} 8 | Exe 9 | Properties 10 | AIProgrammer 11 | AIProgrammer 12 | v4.5 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | {5f99b6a4-5cb2-432b-8018-e2edfbb957f7} 54 | AIProgrammer.Compiler 55 | 56 | 57 | {2fa2525f-4faa-45a6-8268-4d561f7c46f9} 58 | AIProgrammer.Fitness 59 | 60 | 61 | {d1ce7f4d-5142-4fc9-a35b-89f0edaa2936} 62 | AIProgrammer.Functions 63 | 64 | 65 | {8ec97de8-ddfd-437a-b216-91db8d1a3487} 66 | AIProgrammer.GeneticAlgorithm 67 | 68 | 69 | {4f4f1800-be33-4d38-ad95-6835644c076e} 70 | AIProgrammer.Interpreter 71 | 72 | 73 | {06d57f9c-a784-433f-8ff3-0728fecf6f5c} 74 | AIProgrammer.Managers 75 | 76 | 77 | {bd558a71-1699-440f-9876-19322e658e88} 78 | AIProgrammer.Repository 79 | 80 | 81 | {7bcc43b1-33a8-44c8-8f4d-752d89672180} 82 | AIProgrammer.Types 83 | 84 | 85 | 86 | 87 | 94 | -------------------------------------------------------------------------------- /AIProgrammer/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AIProgrammer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AIProgrammer")] 9 | [assembly: AssemblyDescription("AIProgrammer")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AIProgrammer")] 13 | [assembly: AssemblyCopyright("Copyright © 2015 Kory Becker")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("cf02c285-362b-47f9-93cc-cc05c99ddc5a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Results/99bottlesofbeer/99bottlesofbeer-a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/99bottlesofbeer/99bottlesofbeer-a.jpg -------------------------------------------------------------------------------- /Results/99bottlesofbeer/99bottlesofbeer-b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/99bottlesofbeer/99bottlesofbeer-b.jpg -------------------------------------------------------------------------------- /Results/99bottlesofbeer/99bottlesofbeer-c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/99bottlesofbeer/99bottlesofbeer-c.jpg -------------------------------------------------------------------------------- /Results/99bottlesofbeer/99bottlesofbeer-d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/99bottlesofbeer/99bottlesofbeer-d.png -------------------------------------------------------------------------------- /Results/99bottlesofbeer/99bottlesofbeer-e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/99bottlesofbeer/99bottlesofbeer-e.png -------------------------------------------------------------------------------- /Results/99bottlesofbeer/99bottlesofbeer.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/99bottlesofbeer/99bottlesofbeer.exe -------------------------------------------------------------------------------- /Results/99bottlesofbeer/99bottlesofbeer.txt: -------------------------------------------------------------------------------- 1 | ,.+[>g22.<--h.+]]>++--[,],,,<->-][],$<>!,!,,-g,,,+@7$>66++.!-.[!+><+++[[..-<[-t-$--[$.--$-$-$---.>.@7-[.!!>6++-$++++$+$.@7+$6++.+++..!+.@$7--+.+-$[[-[.@7++++.6++++++++.---.@7+++++++.7$6+.!----[..@$>!3$---------------a-.+-b.+!$!!>c@d3----------------.e.f@ -------------------------------------------------------------------------------- /Results/Hi!/Hi!.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/Hi!/Hi!.exe -------------------------------------------------------------------------------- /Results/Hi!/Hi!.txt: -------------------------------------------------------------------------------- 1 | >-----------<++[[++>++<+][]>-.+[+++++++++++++++++++++++++++++><+++.<><-->>>+].] -------------------------------------------------------------------------------- /Results/Hi!/ai-programmer-hii-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/Hi!/ai-programmer-hii-1.jpg -------------------------------------------------------------------------------- /Results/Hi!/ai-programmer-hii-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/Hi!/ai-programmer-hii-2.jpg -------------------------------------------------------------------------------- /Results/Hi!/ai-programmer-hii-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/Hi!/ai-programmer-hii-3.jpg -------------------------------------------------------------------------------- /Results/Hi!/history.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/Hi!/history.xlsx -------------------------------------------------------------------------------- /Results/I love all humans/ai-programmer-iloveallhumans-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/I love all humans/ai-programmer-iloveallhumans-1.jpg -------------------------------------------------------------------------------- /Results/I love all humans/ai-programmer-iloveallhumans-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/I love all humans/ai-programmer-iloveallhumans-2.jpg -------------------------------------------------------------------------------- /Results/I love all humans/ai-programmer-iloveallhumans-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/I love all humans/ai-programmer-iloveallhumans-3.jpg -------------------------------------------------------------------------------- /Results/I love all humans/iloveallhumans.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/I love all humans/iloveallhumans.exe -------------------------------------------------------------------------------- /Results/I love all humans/iloveallhumans.txt: -------------------------------------------------------------------------------- 1 | +[>+<+++]+>------------.+<+++++++++++++++++++++++++++++++.>++++++++++++++++++++++++++++++++++.+++.+++++++.-----------------.--<.>--.+++++++++++..---<.>-.+++++++++++++.--------.------------.+++++++++++++.+++++. -------------------------------------------------------------------------------- /Results/I love all humans/iloveallhumans2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/I love all humans/iloveallhumans2.jpg -------------------------------------------------------------------------------- /Results/add/add.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/add/add.exe -------------------------------------------------------------------------------- /Results/add/add.txt: -------------------------------------------------------------------------------- 1 | ,>,-[-<+>]<+.>][+<+[<>>,>]-->>.[.<,[[,>><<[,.+,<[>,,.--->.[[+<>,[[[+>,.[,-.,>.,--<+<+,,.][+>++-[+++.+.+.[].-+,][<[].<]<][[,].<[[+..]].->-+-]+-+.-].]<,,]+<->.[][.[>.>]+[[<,>[.,,+-]+,+><,.,<-]-.]]+-++->,-.[-+->--]-.].>+.<.>.>,+<.+<..-],.+-,,,><[+-+.>[> 2 | 3 | 4 | 5 | 6 | Short: 7 | 8 | ,>,-[-<+>]<+.> -------------------------------------------------------------------------------- /Results/add/add1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/add/add1.jpg -------------------------------------------------------------------------------- /Results/add/add3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/add/add3.jpg -------------------------------------------------------------------------------- /Results/add/add5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/add/add5.jpg -------------------------------------------------------------------------------- /Results/cats are evil/ifthen-3.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/cats are evil/ifthen-3.exe -------------------------------------------------------------------------------- /Results/cats are evil/ifthen3-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/cats are evil/ifthen3-1.jpg -------------------------------------------------------------------------------- /Results/cats are evil/ifthen3-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/cats are evil/ifthen3-2.jpg -------------------------------------------------------------------------------- /Results/cats are evil/ifthen3-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/cats are evil/ifthen3-3.jpg -------------------------------------------------------------------------------- /Results/cats are evil/ifthen3-history.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/cats are evil/ifthen3-history.xlsx -------------------------------------------------------------------------------- /Results/cats are evil/ifthen3.txt: -------------------------------------------------------------------------------- 1 | >,--[-[7-------------.--.<7++++.-.<-]>>>>7-----------.>7++++++>6+++++++++<.,]>[.>7----.[<<<+]]6+.>6++++++++++++++++++.>6+++++.]-+.<+<.<+++],+[]+.[++[+[+[+,+[+..<.]C+..<-][-+..,>,-+><,><].]<++>>+,]+-,[ -------------------------------------------------------------------------------- /Results/csv split/csvsplit-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/csv split/csvsplit-1.png -------------------------------------------------------------------------------- /Results/csv split/csvsplit-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/csv split/csvsplit-2.png -------------------------------------------------------------------------------- /Results/csv split/csvsplit.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/csv split/csvsplit.exe -------------------------------------------------------------------------------- /Results/csv split/history.txt: -------------------------------------------------------------------------------- 1 | 7/16/2015 3:49:10 PM,6629.1,0,0 2 | 7/16/2015 3:49:12 PM,8375.4,0,100 3 | 7/16/2015 3:49:14 PM,8409.65,0,200 4 | 7/16/2015 3:49:15 PM,8411.8,0,300 5 | 7/16/2015 3:49:17 PM,8414.65,0,400 6 | 7/16/2015 3:49:19 PM,8417.4,0,500 7 | 7/16/2015 3:49:21 PM,8418.65,0,600 8 | 7/16/2015 3:49:22 PM,8420.2,0,700 9 | 7/16/2015 3:49:24 PM,8444.6,0,800 10 | 7/16/2015 3:49:26 PM,8462,0,900 11 | 7/16/2015 3:49:28 PM,8618,0,1000 12 | 7/16/2015 3:49:30 PM,8618.25,0,1100 13 | 7/16/2015 3:49:32 PM,8618.75,0,1200 14 | 7/16/2015 3:49:34 PM,8619.75,0,1300 15 | 7/16/2015 3:49:36 PM,8620.5,0,1400 16 | 7/16/2015 3:49:37 PM,8621,0,1500 17 | 7/16/2015 3:49:39 PM,8621.25,0,1600 18 | 7/16/2015 3:49:41 PM,8621.25,0,1700 19 | 7/16/2015 3:49:43 PM,8625,0,1800 20 | 7/16/2015 3:49:44 PM,8625.5,0,1900 21 | 7/16/2015 3:49:48 PM,8625.5,0,2000 22 | 7/16/2015 3:49:50 PM,8626,0,2100 23 | 7/16/2015 3:49:52 PM,8626.5,0,2200 24 | 7/16/2015 3:49:54 PM,8626.5,0,2300 25 | 7/16/2015 3:49:56 PM,8626.75,0,2400 26 | 7/16/2015 3:49:58 PM,8626.75,0,2500 27 | 7/16/2015 3:49:59 PM,8626.75,0,2600 28 | 7/16/2015 3:50:01 PM,8626.75,0,2700 29 | 7/16/2015 3:50:02 PM,8626.75,0,2800 30 | 7/16/2015 3:50:04 PM,8626.75,0,2900 31 | 7/16/2015 3:50:06 PM,8626.75,0,3000 32 | 7/16/2015 3:50:08 PM,8626.75,0,3100 33 | 7/16/2015 3:50:10 PM,8626.75,0,3200 34 | 7/16/2015 3:50:12 PM,8626.75,0,3300 35 | 7/16/2015 3:50:13 PM,8626.75,0,3400 36 | 7/16/2015 3:50:15 PM,8626.75,0,3500 37 | 7/16/2015 3:50:17 PM,8626.75,0,3600 38 | 7/16/2015 3:50:19 PM,8626.75,0,3700 39 | 7/16/2015 3:50:21 PM,8626.75,0,3800 40 | 7/16/2015 3:50:23 PM,8626.75,0,3900 41 | 7/16/2015 3:50:25 PM,8626.75,0,4000 42 | 7/16/2015 3:50:27 PM,8626.75,0,4100 43 | 7/16/2015 3:50:29 PM,8626.75,0,4200 44 | 7/16/2015 3:50:30 PM,8626.75,0,4300 45 | 7/16/2015 3:50:33 PM,8626.75,0,4400 46 | 7/16/2015 3:50:34 PM,8626.75,0,4500 47 | 7/16/2015 3:50:36 PM,8626.75,0,4600 48 | 7/16/2015 3:50:38 PM,8626.75,0,4700 49 | 7/16/2015 3:50:40 PM,8626.75,0,4800 50 | 7/16/2015 3:50:42 PM,8626.75,0,4900 51 | 7/16/2015 3:50:44 PM,8626.75,0,5000 52 | 7/16/2015 3:50:46 PM,8626.75,0,5100 53 | 7/16/2015 3:50:48 PM,8626.75,0,5200 54 | 7/16/2015 3:50:49 PM,8626.75,0,5300 55 | 7/16/2015 3:50:51 PM,8626.75,0,5400 56 | 7/16/2015 3:50:53 PM,8626.75,0,5500 57 | 7/16/2015 3:50:55 PM,8626.75,0,5600 58 | 7/16/2015 3:50:57 PM,8626.75,0,5700 59 | 7/16/2015 3:51:00 PM,8626.75,0,5800 60 | 7/16/2015 3:51:02 PM,8626.75,0,5900 61 | 7/16/2015 3:51:04 PM,8626.75,0,6000 62 | 7/16/2015 3:51:06 PM,8626.75,0,6100 63 | 7/16/2015 3:51:08 PM,8628.75,0,6200 64 | 7/16/2015 3:51:10 PM,8628.75,0,6300 65 | 7/16/2015 3:51:12 PM,8629.75,0,6400 66 | 7/16/2015 3:51:13 PM,8633.25,0,6500 67 | 7/16/2015 3:51:16 PM,8633.25,0,6600 68 | 7/16/2015 3:51:17 PM,8635,0,6700 69 | 7/16/2015 3:51:19 PM,8635.5,0,6800 70 | 7/16/2015 3:51:21 PM,8635.5,0,6900 71 | 7/16/2015 3:51:23 PM,8635.5,0,7000 72 | 7/16/2015 3:51:25 PM,8635.75,0,7100 73 | 7/16/2015 3:51:27 PM,8635.75,0,7200 74 | 7/16/2015 3:51:29 PM,8635.75,0,7300 75 | 7/16/2015 3:51:31 PM,8635.75,0,7400 76 | 7/16/2015 3:51:33 PM,8639.5,0,7500 77 | 7/16/2015 3:51:35 PM,8640,0,7600 78 | 7/16/2015 3:51:37 PM,8640,0,7700 79 | 7/16/2015 3:51:39 PM,8640,0,7800 80 | 7/16/2015 3:51:41 PM,8640.25,0,7900 81 | 7/16/2015 3:51:43 PM,8644.75,0,8000 82 | 7/16/2015 3:51:45 PM,8649.25,0,8100 83 | 7/16/2015 3:51:47 PM,8658,0,8200 84 | 7/16/2015 3:51:49 PM,8658.25,0,8300 85 | 7/16/2015 3:51:51 PM,8658.25,0,8400 86 | 7/16/2015 3:51:53 PM,8658.25,0,8500 87 | 7/16/2015 3:51:55 PM,8658.25,0,8600 88 | 7/16/2015 3:51:57 PM,8667,0,8700 89 | 7/16/2015 3:51:59 PM,8667,0,8800 90 | 7/16/2015 3:52:01 PM,8670.75,0,8900 91 | 7/16/2015 3:52:03 PM,8675.25,0,9000 92 | -------------------------------------------------------------------------------- /Results/csv split/program.txt: -------------------------------------------------------------------------------- 1 | ,[.,.,.2+++++++$+++++.,]]+[!![,>-+[$.!!$[[+!>..][[][[$>[$>+][,]<-,<<[+-,<+->-]-..-,$[-.[$[]$.. -------------------------------------------------------------------------------- /Results/extractinquotes/extract-in-quotes-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/extractinquotes/extract-in-quotes-1.png -------------------------------------------------------------------------------- /Results/extractinquotes/extractinquotes.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/extractinquotes/extractinquotes.exe -------------------------------------------------------------------------------- /Results/extractinquotes/program.txt: -------------------------------------------------------------------------------- 1 | -+,>,<,[$,>+-.!<]<][!+[<[[+$+[[+<[[>$+[[-+$,->!>>$<$[+-,>6,$.-><-[!-[$>,+,,[,!+>!,,[$![!5@,$+*+[[$---][!][]+>+[$<$>+,>,+-*++$+!<><>$-<*<>>,],+**!!<,,,![[,@ -------------------------------------------------------------------------------- /Results/extractinquotes2/extract-in-quotes-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/extractinquotes2/extract-in-quotes-1.png -------------------------------------------------------------------------------- /Results/extractinquotes2/extract-in-quotes-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/extractinquotes2/extract-in-quotes-2-1.png -------------------------------------------------------------------------------- /Results/extractinquotes2/extract-in-quotes-2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/extractinquotes2/extract-in-quotes-2-2.png -------------------------------------------------------------------------------- /Results/extractinquotes2/extract-in-quotes-2-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/extractinquotes2/extract-in-quotes-2-3.png -------------------------------------------------------------------------------- /Results/extractinquotes2/extract-in-quotes-2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/extractinquotes2/extract-in-quotes-2.exe -------------------------------------------------------------------------------- /Results/extractinquotes2/extract-in-quotes-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/extractinquotes2/extract-in-quotes-2.png -------------------------------------------------------------------------------- /Results/extractinquotes2/extract-in-quotes.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/extractinquotes2/extract-in-quotes.exe -------------------------------------------------------------------------------- /Results/fibonacci/fibonacci-2/fibonacci-2-history.txt: -------------------------------------------------------------------------------- 1 | 11/28/2014 6:43:09 PM,1458.88,0,0 2 | 11/28/2014 6:43:10 PM,1503.973,0,100 3 | 11/28/2014 6:43:12 PM,1582.976,0,200 4 | 11/28/2014 6:43:19 PM,1596.976,0,300 5 | 11/28/2014 6:43:34 PM,1596.979,0,400 6 | 11/28/2014 6:43:41 PM,1596.982,0,500 7 | -------------------------------------------------------------------------------- /Results/fibonacci/fibonacci-2/fibonacci-2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/fibonacci/fibonacci-2/fibonacci-2.exe -------------------------------------------------------------------------------- /Results/fibonacci/fibonacci-2/fibonacci-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/fibonacci/fibonacci-2/fibonacci-2.jpg -------------------------------------------------------------------------------- /Results/fibonacci/fibonacci-3/fibbonaci-3a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/fibonacci/fibonacci-3/fibbonaci-3a.jpg -------------------------------------------------------------------------------- /Results/fibonacci/fibonacci-3/fibonacci-3b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/fibonacci/fibonacci-3/fibonacci-3b.jpg -------------------------------------------------------------------------------- /Results/fibonacci/fibonacci-3/fibonnaci-3.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/fibonacci/fibonacci-3/fibonnaci-3.exe -------------------------------------------------------------------------------- /Results/fibonacci/fibonacci-4/fibonnaci-4.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/fibonacci/fibonacci-4/fibonnaci-4.exe -------------------------------------------------------------------------------- /Results/fibonacci/fibonacci-4/fibonnaci-4.txt: -------------------------------------------------------------------------------- 1 | ,>,$[!>--$<>]4]+,,-[-<+>]<+.$@ -------------------------------------------------------------------------------- /Results/fibonacci/fibonacci-4/fibonnaci-4a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/fibonacci/fibonacci-4/fibonnaci-4a.jpg -------------------------------------------------------------------------------- /Results/fibonacci/fibonacci-4/fibonnaci-4b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/fibonacci/fibonacci-4/fibonnaci-4b.jpg -------------------------------------------------------------------------------- /Results/fibonacci/fibonacci-4/fibonnaci-4c.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/fibonacci/fibonacci-4/fibonnaci-4c.jpg -------------------------------------------------------------------------------- /Results/fibonacci/fibonacci-4/fibonnaci-4d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/fibonacci/fibonacci-4/fibonnaci-4d.png -------------------------------------------------------------------------------- /Results/hello world/ai-programmer-helloworld-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hello world/ai-programmer-helloworld-1.jpg -------------------------------------------------------------------------------- /Results/hello world/ai-programmer-helloworld-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hello world/ai-programmer-helloworld-2.jpg -------------------------------------------------------------------------------- /Results/hello world/hello world.txt: -------------------------------------------------------------------------------- 1 | -><[>-<+++]->>++++[++++++++++++++++++<+]>.---.+-+++++++..+++.+>+<><+[+><><>+++++++++.+-<-++++[++[.--------.+++.------],.-----],,.>.+<<<[><<>]<++>+.[]+[.[+]],[[.]..,<]]],]<+]],[]],[[+[,+[]-<.,.],--+]-++-[,<.+-<[-<]-><>-]-<>+[-,-[<.>][--+<>+<><++<><-,,-,[,[.>]]<-+[.>+[<.<],]<<<>].[--+[<<->--],-+>]-,[, -------------------------------------------------------------------------------- /Results/hello world/helloworld.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hello world/helloworld.exe -------------------------------------------------------------------------------- /Results/hello world/history.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hello world/history.xlsx -------------------------------------------------------------------------------- /Results/hello-user/hellouser.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hello-user/hellouser.exe -------------------------------------------------------------------------------- /Results/hello-user/hellouser.txt: -------------------------------------------------------------------------------- 1 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[++++++++[++++.+++++++++++++++++++++++++++++.+++++[++..<>+++.>+++++++++++++++++++++++++++++<>++++-.[,.,.,.,.]].].][.,]-,-]][+.--+><<..>[+>[+.<+,]><<>]<><<.>.,--<>[<>-,,,><.>.<-,][-[-,-[.-[-+ 2 | 3 | 4 | 5 | Short: 6 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[++++++++[++++.+++++++++++++++++++++++++++++.+++++[++..<>+++.>+++++++++++++++++++++++++++++<>++++-.[,.,.,.,.]]]] -------------------------------------------------------------------------------- /Results/hello-user/hellouser1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hello-user/hellouser1.jpg -------------------------------------------------------------------------------- /Results/hello-user/hellouser2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hello-user/hellouser2.jpg -------------------------------------------------------------------------------- /Results/hello/ai-programmer-hello-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hello/ai-programmer-hello-1.jpg -------------------------------------------------------------------------------- /Results/hello/ai-programmer-hello-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hello/ai-programmer-hello-2.jpg -------------------------------------------------------------------------------- /Results/hello/ai-programmer-hello-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hello/ai-programmer-hello-3.jpg -------------------------------------------------------------------------------- /Results/hello/ai-programmer-hello-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hello/ai-programmer-hello-4.jpg -------------------------------------------------------------------------------- /Results/hello/hello.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hello/hello.exe -------------------------------------------------------------------------------- /Results/hello/hello.txt: -------------------------------------------------------------------------------- 1 | +-+-+>-<[++++>+++++<+<>++]>[-[---.--[[-.++++[+++..].]]]] -------------------------------------------------------------------------------- /Results/hello/history.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hello/history.xlsx -------------------------------------------------------------------------------- /Results/hi/ai-programmer-hi-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hi/ai-programmer-hi-1.jpg -------------------------------------------------------------------------------- /Results/hi/ai-programmer-hi-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hi/ai-programmer-hi-2.jpg -------------------------------------------------------------------------------- /Results/hi/ai-programmer-hi-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hi/ai-programmer-hi-3.jpg -------------------------------------------------------------------------------- /Results/hi/ai-programmer-hi-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hi/ai-programmer-hi-4.jpg -------------------------------------------------------------------------------- /Results/hi/ai-programmer-hi-5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hi/ai-programmer-hi-5.jpg -------------------------------------------------------------------------------- /Results/hi/ai-programmer-hi.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hi/ai-programmer-hi.xlsx -------------------------------------------------------------------------------- /Results/hi/hi.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/hi/hi.exe -------------------------------------------------------------------------------- /Results/hi/hi.txt: -------------------------------------------------------------------------------- 1 | +[+++++-+>++>++-++++++<<]>++.[+.] -------------------------------------------------------------------------------- /Results/hi/history.txt: -------------------------------------------------------------------------------- 1 | 1/23/2013 2:10:16 PM,305,512,0 2 | 1/23/2013 2:10:17 PM,318,512,100 3 | 1/23/2013 2:10:18 PM,320,512,200 4 | 1/23/2013 2:10:18 PM,320,512,300 5 | 1/23/2013 2:10:19 PM,326,512,400 6 | 1/23/2013 2:10:20 PM,327,512,500 7 | 1/23/2013 2:10:21 PM,327,512,600 8 | 1/23/2013 2:10:22 PM,341,512,700 9 | 1/23/2013 2:10:23 PM,342,512,800 10 | 1/23/2013 2:10:24 PM,344,512,900 11 | 1/23/2013 2:10:25 PM,344,512,1000 12 | 1/23/2013 2:10:26 PM,344,512,1100 13 | 1/23/2013 2:10:27 PM,344,512,1200 14 | 1/23/2013 2:10:28 PM,344,512,1300 15 | 1/23/2013 2:10:29 PM,344,512,1400 16 | 1/23/2013 2:10:29 PM,344,512,1500 17 | 1/23/2013 2:10:30 PM,344,512,1600 18 | 1/23/2013 2:10:31 PM,346,512,1700 19 | 1/23/2013 2:10:32 PM,346,512,1800 20 | 1/23/2013 2:10:33 PM,346,512,1900 21 | 1/23/2013 2:10:34 PM,355,512,2000 22 | 1/23/2013 2:10:35 PM,359,512,2100 23 | 1/23/2013 2:10:36 PM,359,512,2200 24 | 1/23/2013 2:10:37 PM,361,512,2300 25 | 1/23/2013 2:10:38 PM,361,512,2400 26 | 1/23/2013 2:10:39 PM,361,512,2500 27 | 1/23/2013 2:10:40 PM,361,512,2600 28 | 1/23/2013 2:10:40 PM,361,512,2700 29 | 1/23/2013 2:10:41 PM,361,512,2800 30 | 1/23/2013 2:10:42 PM,361,512,2900 31 | 1/23/2013 2:10:43 PM,361,512,3000 32 | 1/23/2013 2:10:44 PM,361,512,3100 33 | 1/23/2013 2:10:45 PM,361,512,3200 34 | 1/23/2013 2:10:46 PM,361,512,3300 35 | 1/23/2013 2:10:47 PM,361,512,3400 36 | 1/23/2013 2:10:48 PM,361,512,3500 37 | 1/23/2013 2:10:49 PM,361,512,3600 38 | 1/23/2013 2:10:50 PM,361,512,3700 39 | 1/23/2013 2:10:51 PM,361,512,3800 40 | 1/23/2013 2:10:52 PM,361,512,3900 41 | 1/23/2013 2:10:53 PM,361,512,4000 42 | 1/23/2013 2:10:54 PM,362,512,4100 43 | 1/23/2013 2:10:55 PM,365,512,4200 44 | 1/23/2013 2:10:56 PM,365,512,4300 45 | 1/23/2013 2:10:57 PM,368,512,4400 46 | 1/23/2013 2:10:57 PM,368,512,4500 47 | 1/23/2013 2:10:58 PM,368,512,4600 48 | 1/23/2013 2:10:59 PM,368,512,4700 49 | 1/23/2013 2:11:00 PM,368,512,4800 50 | 1/23/2013 2:11:01 PM,503,512,4900 51 | 1/23/2013 2:11:02 PM,505,512,5000 52 | 1/23/2013 2:11:03 PM,507,512,5100 53 | 1/23/2013 2:11:04 PM,509,512,5200 54 | 1/23/2013 2:11:05 PM,512,512,5300 55 | 1/23/2013 2:11:05 PM,512,512,5400 56 | 1/23/2013 2:11:06 PM,512,512,5500 57 | 1/23/2013 2:11:07 PM,512,512,5600 58 | 1/23/2013 2:11:08 PM,512,512,5700 59 | -------------------------------------------------------------------------------- /Results/if-then/ifthen-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/if-then/ifthen-1.jpg -------------------------------------------------------------------------------- /Results/if-then/ifthen-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/if-then/ifthen-2.jpg -------------------------------------------------------------------------------- /Results/if-then/ifthen.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/if-then/ifthen.exe -------------------------------------------------------------------------------- /Results/if-then/ifthen.txt: -------------------------------------------------------------------------------- 1 | ,-[-[>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.[<+][]]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[++++++++++++++++++++++++++++++++++++++++++++++++++++++++.<]]>++++<>++++++++++++++++++++++[+[+++++++++++++++++++++[++++[+++++++++++++++++++++++++++++++++++++++++++++. -------------------------------------------------------------------------------- /Results/if-then/ifthen2-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/if-then/ifthen2-1.jpg -------------------------------------------------------------------------------- /Results/if-then/ifthen2-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/if-then/ifthen2-2.jpg -------------------------------------------------------------------------------- /Results/if-then/ifthen2-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/if-then/ifthen2-3.jpg -------------------------------------------------------------------------------- /Results/if-then/ifthen2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/if-then/ifthen2.exe -------------------------------------------------------------------------------- /Results/if-then/ifthen2.txt: -------------------------------------------------------------------------------- 1 | [[]]>++++>+<+++++++++++++++<--[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>]++++++++++++++++++++++++++++++++++++>,-[--[>[][[,[]]]+[<<<<.]]<+++++++++++++++++++++++++++++++++++++++++++++++++++++++<++++++++++++++>+++++++.<++-++.<<.<]++++++++++++++++++++++++++++++++++++++++++++++++++++[+++++[+++++++++++++[++++++++++++++++++++++++++++++++++.>+++++++++++[+++++><><++++++++++++++++<>++++++[++<>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<>+++++.<<<<<<[[[,,,<<.+-[[+.[>[-]]-[+[<<,[<<[<[,]>[<,]>[<><<.[+<,,]++-]--[+<-[-][..-<-------<>..<[]<[>[,>.>+[,<>][,],][+->[.]+[.[[.]]<[...[+ -------------------------------------------------------------------------------- /Results/keepcalmkeepcoding/keepcalmkeepcoding-a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/keepcalmkeepcoding/keepcalmkeepcoding-a.jpg -------------------------------------------------------------------------------- /Results/keepcalmkeepcoding/keepcalmkeepcoding.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/keepcalmkeepcoding/keepcalmkeepcoding.exe -------------------------------------------------------------------------------- /Results/keepcalmkeepcoding/keepcalmkeepcoding.txt: -------------------------------------------------------------------------------- 1 | 1+$-+--!++>$<+++++++$+$$+++[++a.b$!.$a$+-.-[>c$$]]@5-----.7------$-----..!++++++.[]--o+>+>]>]]]+$!]>+@4+++.6+.7----.+.>>>!><->>[-<>,>+.[>>>>>>>>+>,,+]!]@>>4+-+-+++.+7-$.--$---------.+++++.--.[<@ -------------------------------------------------------------------------------- /Results/logical-xor/program.txt: -------------------------------------------------------------------------------- 1 | ,[,[>+[[+][].--<+><<]+[],,,><[>>]-<<<.-[>,],<,]>,<+.>[>-,,<],--<],.]++.>-->.>]>+>,,.[.<[<-.--[,+>.]] -------------------------------------------------------------------------------- /Results/logical-xor/xor-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/logical-xor/xor-1.png -------------------------------------------------------------------------------- /Results/logical-xor/xor-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/logical-xor/xor-2.png -------------------------------------------------------------------------------- /Results/logical-xor/xor.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/logical-xor/xor.exe -------------------------------------------------------------------------------- /Results/reddit/ai-programmer-reddit-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/reddit/ai-programmer-reddit-1.jpg -------------------------------------------------------------------------------- /Results/reddit/ai-programmer-reddit-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/reddit/ai-programmer-reddit-2.jpg -------------------------------------------------------------------------------- /Results/reddit/ai-programmer-reddit-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/reddit/ai-programmer-reddit-3.jpg -------------------------------------------------------------------------------- /Results/reddit/history.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/reddit/history.xlsx -------------------------------------------------------------------------------- /Results/reddit/reddit.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/reddit/reddit.exe -------------------------------------------------------------------------------- /Results/reddit/reddit.txt: -------------------------------------------------------------------------------- 1 | +[+++++>++<]+>++++++[[++++++.-------------.-.-+.+++++.+++++],.,+,-+-,+>+.++<<+<><+]-[-<>.]>+.-.+..]< -------------------------------------------------------------------------------- /Results/reverse-string/reverse-history.txt: -------------------------------------------------------------------------------- 1 | 2/8/2013 11:27:16 AM,4124.3,0,0 2 | 2/8/2013 11:27:18 AM,4232.2,0,100 3 | 2/8/2013 11:27:20 AM,4247.1,0,200 4 | 2/8/2013 11:27:22 AM,4255,0,300 5 | 2/8/2013 11:27:24 AM,4256.5,0,400 6 | 2/8/2013 11:27:26 AM,4257.75,0,500 7 | 2/8/2013 11:27:28 AM,4259.75,0,600 8 | 2/8/2013 11:27:29 AM,4260.25,0,700 9 | 2/8/2013 11:27:31 AM,4261.25,0,800 10 | 2/8/2013 11:27:33 AM,4261.25,0,900 11 | 2/8/2013 11:27:35 AM,4261.75,0,1000 12 | 2/8/2013 11:27:37 AM,4262,0,1100 13 | 2/8/2013 11:27:39 AM,4262.25,0,1200 14 | 2/8/2013 11:27:41 AM,4262.25,0,1300 15 | 2/8/2013 11:27:43 AM,4262.5,0,1400 16 | 2/8/2013 11:27:44 AM,4262.5,0,1500 17 | 2/8/2013 11:27:46 AM,4262.5,0,1600 18 | 2/8/2013 11:27:48 AM,4262.5,0,1700 19 | 2/8/2013 11:27:50 AM,4262.5,0,1800 20 | 2/8/2013 11:27:51 AM,4262.5,0,1900 21 | 2/8/2013 11:27:53 AM,4262.5,0,2000 22 | 2/8/2013 11:27:55 AM,4262.5,0,2100 23 | 2/8/2013 11:27:57 AM,4262.5,0,2200 24 | 2/8/2013 11:27:59 AM,4262.5,0,2300 25 | 2/8/2013 11:28:01 AM,4262.5,0,2400 26 | 2/8/2013 11:28:03 AM,4262.5,0,2500 27 | 2/8/2013 11:28:05 AM,4263.25,0,2600 28 | -------------------------------------------------------------------------------- /Results/reverse-string/reverse.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/reverse-string/reverse.exe -------------------------------------------------------------------------------- /Results/reverse-string/reverse.txt: -------------------------------------------------------------------------------- 1 | +->,>,[>+,],,,,-<[.+<].[>[,,<,>><,-+[]-[<[<>>+-<[,+]]>><[,[].-[]<[>]+[.->+.+,>-[<+-+]->>,<>,>-+][,-.<--+<[[[,+>-+]-]>,><-[>,+<[<...[++[+.><<-..[,<[+<]-<>+-,,>,,,-.[,+,+]<>>].+]]-,...[.<,,.],-[].]<[><,<.>>[+.-+--,++].+[]..]><.-][.,-,>][+][+,--,<--.<+] 2 | 3 | 4 | 5 | Short: 6 | 7 | +->,>,[>+,],,,,-<[.+<] -------------------------------------------------------------------------------- /Results/reverse-string/reverse1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/reverse-string/reverse1.jpg -------------------------------------------------------------------------------- /Results/reverse-string/reverse2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/reverse-string/reverse2.jpg -------------------------------------------------------------------------------- /Results/string-length/output.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/string-length/output.exe -------------------------------------------------------------------------------- /Results/string-length/string-length-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/string-length/string-length-1.png -------------------------------------------------------------------------------- /Results/subtract/subtract.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/subtract/subtract.exe -------------------------------------------------------------------------------- /Results/subtract/subtract.txt: -------------------------------------------------------------------------------- 1 | >,<,[->-<][--.[---+<.>[[.>-][...[[]--[[+>.--,+><,<[][],[<<<].<,[>++][.>+..].<[]+-.+[+..>>]]]]+<---[]+<]+<<-,>][]->]<]><+.<+,,]++>.[,[]-[[]-[>[><+,+,.+..++..><[.[><-[><-[[++--]<+,<,<<<+..<<<,.<<,<,..<<,++>>,>.-[.<-<<[<,<<]++<>.+[,<.<.+.<[][<.<<]+<+.[] -------------------------------------------------------------------------------- /Results/subtract/subtract11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/subtract/subtract11.jpg -------------------------------------------------------------------------------- /Results/subtract/subtract2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/subtract/subtract2.exe -------------------------------------------------------------------------------- /Results/subtract/subtract2.txt: -------------------------------------------------------------------------------- 1 | ,->,[-[+<+>]<.[+[]<[--<+[,.<]<<<<-++-[,],,.+-,>,+.>+<<..+>.+<[.+<.+<+-..<,<.[-]<[,<<,--+<>.<<[.[-,[<+>-[-<..[<[<+>+<+<<-[+[<+.[[+>>><>+,]<>>[<,<[[+<[+[<+,[[,+,<]>,<<][+.[+-]-.<,[,[[-++,[>]]][-[[[>[>]+->]]+.<+]><-+.[[+,.>,[[+,--][<]<[>-<-->.,[-<+.],>, 2 | 3 | 4 | 5 | 6 | Short: 7 | 8 | ,->,[-[+<+>]<.[ 9 | 10 | Version 2: 11 | ,-->,-[-<->]<+.,[+-[,,]+[-.[[]],[+>--+,>->],<+[.<>.[,][,,><[.<,]][]+],>[-+,[-+[+-[-[[--<>,>[[],---]+<[[,>].[,<[.,,[-.<.[-<[+]<>.-<<..+[<<+]-]<]+<>,[].,,,.]<-[<>>[+[<><,[<>,+-],-,+]+>.<><--[.]<[,,<][,[ 12 | 13 | Short: 14 | ,-->,-[-<->]<+. -------------------------------------------------------------------------------- /Results/subtract/subtract21.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/subtract/subtract21.jpg -------------------------------------------------------------------------------- /Results/subtract/subtract23.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/subtract/subtract23.jpg -------------------------------------------------------------------------------- /Results/timesthree/timesthree-a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/timesthree/timesthree-a.jpg -------------------------------------------------------------------------------- /Results/timesthree/timesthree-b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/timesthree/timesthree-b.jpg -------------------------------------------------------------------------------- /Results/timesthree/timesthree-c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/timesthree/timesthree-c.png -------------------------------------------------------------------------------- /Results/timesthree/timesthree.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/timesthree/timesthree.exe -------------------------------------------------------------------------------- /Results/timesthree/timesthree.txt: -------------------------------------------------------------------------------- 1 | >->,b<--.,.]]+--]+->@,>,-[-<+>]<+$@++[+[>,$[-<-a!a!$@ -------------------------------------------------------------------------------- /Results/timestwo/timestwo-a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/timestwo/timestwo-a.jpg -------------------------------------------------------------------------------- /Results/timestwo/timestwo-b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/timestwo/timestwo-b.jpg -------------------------------------------------------------------------------- /Results/timestwo/timestwo-c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/timestwo/timestwo-c.png -------------------------------------------------------------------------------- /Results/timestwo/timestwo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/timestwo/timestwo.exe -------------------------------------------------------------------------------- /Results/timestwo/timestwo.txt: -------------------------------------------------------------------------------- 1 | ++[+[>,$[-<-a!a!.!]a>...,..,.]@,>,-[-<+>]<+$@ 2 | 3 | Note: Notice the AI took advantage of a buffer underflow exception by decrementing the memory pointer to -1, forcing an exception in the interpreter and ending the program (optimally early). After the first print statement with the correct answer, the next loop iteration decrements the memory pointer, causing the exception. This is technically correct, since the AI is not penalized for exceptions. -------------------------------------------------------------------------------- /Results/trimleftofquote/program.txt: -------------------------------------------------------------------------------- 1 | +++++$!+$++++++++++[+++++[+++++++++$$++>,-<++.>!-+$$>!>,>a!-,a!]+>-,.++!!+$-+[>,.$>,[.,+-],$<+!!>@A!,+*+>+*+<[[---$*]]>-,[-@-+,>,<,[$,>+-.!<]<][!+[<[[+$+[[+<[[>$+[[-+$,->!>>$<$[+-,>6,$.-><-[!-[$>,+,,[,!+>!,,[$![!5@ -------------------------------------------------------------------------------- /Results/trimleftofquote/trimleftofquote-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/trimleftofquote/trimleftofquote-1.png -------------------------------------------------------------------------------- /Results/warningcountdown/history.txt: -------------------------------------------------------------------------------- 1 | 7/14/2015 10:44:40 AM,48227,0,0 2 | 7/14/2015 10:44:43 AM,66544,0,100 3 | 7/14/2015 10:44:49 AM,66544,0,200 4 | 7/14/2015 10:44:54 AM,66828.45,0,300 5 | 7/14/2015 10:44:59 AM,66830.1,0,400 6 | 7/14/2015 10:45:04 AM,66830.25,0,500 7 | 7/14/2015 10:45:12 AM,66830.25,0,600 8 | 7/14/2015 10:45:18 AM,66831.15,0,700 9 | 7/14/2015 10:45:23 AM,66833.85,0,800 10 | 7/14/2015 10:45:28 AM,66843,0,900 11 | -------------------------------------------------------------------------------- /Results/warningcountdown/program.txt: -------------------------------------------------------------------------------- 1 | r,+-+[f-.].-]+-,,[,>,[,,[,,][[@7+>+5+++++++.<+$6<>+.!.--[--.-@7[[--$----+--.!.-------.$2.+>$@4+++.[$77-.++++++$!!!$[$.7--.-@7++++.$6++++[.!-----.!+++.[><[@++3>+++++++7-[-.<++++++++++.2.@+abc!!!!!$-!-$d+$>+l!>>!<>>-e-@ -------------------------------------------------------------------------------- /Results/warningcountdown/warningcountdown.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/warningcountdown/warningcountdown.exe -------------------------------------------------------------------------------- /Results/warningcountdown/warningcountdown1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/warningcountdown/warningcountdown1.png -------------------------------------------------------------------------------- /Results/warningcountdown/warningcountdown2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/warningcountdown/warningcountdown2.png -------------------------------------------------------------------------------- /Results/warningcountdown/warningcountdown3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/warningcountdown/warningcountdown3.png -------------------------------------------------------------------------------- /Results/xml2json/program.txt: -------------------------------------------------------------------------------- 1 | 8-----.,3--------------.$,.!.,----.!.,.,.++++++++++.!.8---.]!!!,!+$[[-<-,..-[!>$-[.>][,<.$>,$+<<],$.+,$]<$+><[..$-,-,,!..,,!!>>->[+>.$!,+,<<<>.],>$!>-$<]![,]-,! -------------------------------------------------------------------------------- /Results/xml2json/xml2json.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/xml2json/xml2json.exe -------------------------------------------------------------------------------- /Results/xml2json/xmltojson-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/xml2json/xmltojson-1.png -------------------------------------------------------------------------------- /Results/xml2json/xmltojson-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/Results/xml2json/xmltojson-2.png -------------------------------------------------------------------------------- /lib/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/primaryobjects/AI-Programmer/1b2faab214055b720fafb5d5e2a29319964c1f24/lib/Newtonsoft.Json.dll --------------------------------------------------------------------------------