コード例 #1
0
        private void CreateFiles(int generation, int individual, Individual genes)
        {
            // assign robot name
            var robotId = RobotFileCreator.GetRobotId(generation, individual);

            // create dir path and directory
            var robotDirectoryPath = Path.Combine(_directoryPath, robotId);

            Directory.CreateDirectory(robotDirectoryPath);

            var dirPathFull = Path.Combine(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName),
                                           robotDirectoryPath);

            var dllFileCreator    = new DllFileCreator();
            var battleFileCreator = new BattleFileCreator();
            var robotFileCreator  = new RobotFileCreator();
            var stateCreator      = new RobotStateFileCreator();

            var dnaTranslator = new DnaToCode(genes);                   //In later iteration, replace with Factory

            // create files, compile robot
            robotFileCreator.CreateRobotFiles(robotDirectoryPath, robotId, dnaTranslator);
            stateCreator.CreateStateFiles(robotDirectoryPath, robotId, dnaTranslator);
            dllFileCreator.CreateDll(_dllDirectoryPath, robotDirectoryPath, robotId, dnaTranslator);
            battleFileCreator.CreateBattleFiles(robotDirectoryPath, NameSpace, robotId);

            // run battles
            RoboCodeMatchHandler.RunBattles(dirPathFull);
        }
コード例 #2
0
 internal Individual(int generation, int individual)
 {
     RobotId = RobotFileCreator.GetRobotId(generation, individual);
 }