コード例 #1
0
 public static void EnhanceDesign(bool gammarsSetByUser)
 {
     if (!gammarsSetByUser)
     {
         String strGrammar = String.Empty;
         strGrammar = StaticData.EngineManager.PrefCompsManager.GetPrefCompsToGrammarFile();
         StreamWriter sw = new StreamWriter(FileGrammarPath);
         sw.Write(strGrammar);
         sw.Flush();
         sw.Close();
     }
     if (StaticData.CtrLevelDesigner.rbPCNone.Checked ||
         (
             (StaticData.CtrLevelDesigner.rbPCNone.Checked == false &&
              StaticData.CtrLevelDesigner.rbPCNormalCheck.Checked == false) &&
             StaticData.CtrLevelDesigner.rbPCRandom.Checked == false
         )
         )
     {
         GenericHelperModule.RunJavaProcess(@"C:\CTREngine\AuthoringToolEngineGEVAOnly.jar");
         StreamReader sr = new StreamReader(@"C:\CTREngine\EvolvedLevel.txt");
         GevaLevel          = sr.ReadToEnd().Split('\n')[0];
         PlayabilityActions = String.Empty;
         sr.Close();
     }
     else
     {
         if (StaticData.CtrLevelDesigner.rbPCNormalCheck.Checked)
         {
             GenericHelperModule.RunJavaProcess(
                 @"C:\CTREngine\AuthoringToolEngineWithNormalPlayFitness.jar");
         }
         else
         {
             if (StaticData.CtrLevelDesigner.rbPCRandom.Checked)
             {
                 GenericHelperModule.RunJavaProcess(
                     @"C:\CTREngine\AuthoringToolEngineWithRandomPlayFitness.jar");
             }
         }
         StreamReader sr =
             new StreamReader(@"C:\CTREngine\PhysicsEngine_EvolvePlayActions.txt");
         String line = sr.ReadToEnd();
         GevaLevel          = line.Split('\t')[13];
         PlayabilityActions = line.Split('\t')[14];
         if (line.Split('\t')[1].ToLower() == "true")
         {
             MessageBox.Show(
                 @"Playability-check is finished. The engine has found a playable level.");
         }
         sr.Close();
     }
     LevelBuilder.CreateRestedLevel(DesignEnhanceManager.GevaLevel, false);
     StaticData.ManipulationGameMode = ManipulationGameMode.NeutralMode;
     StaticData.GameSessionMode      = SessionMode.DesignMode;
 }
コード例 #2
0
        private void bGenerateSamples_Click(object sender, EventArgs e)
        {
            GenericHelperModule.RunJavaProcess(@"C:\CTREngine\AuthoringToolEngineGEVAOnly.jar");
            StreamReader sr        = new StreamReader(@"C:\CTREngine\EvolvedLevel.txt");
            String       gevaLevel = sr.ReadToEnd().Split('\n')[0];

            sr.Close();
            LevelBuilder.CreateRestedLevel(gevaLevel, false);
            StaticData.ManipulationGameMode = ManipulationGameMode.NeutralMode;
            StaticData.GameSessionMode      = SessionMode.DesignMode;
        }
コード例 #3
0
        public static List <Action> GetNextActionsSet(ref int voidInitPlayCount, PlayabilityCheckMode checkMode)
        {
            if (voidInitPlayCount < VoidInitPlayTotalCount)
            {
                voidInitPlayCount++;
                return(new List <Action>()
                {
                    new VoidAction()
                });
            }
            List <Action> listOfAllPossibleActions = null;

            switch (checkMode)
            {
            case PlayabilityCheckMode.NormalCheck:
                // Set Engine State Into Predicates File
                SetEngineStateIntoPredicatesFile();

                // Run Prolog
                GenericHelperModule.RunJavaProcess(_prologEnginePath);

                // Get new actions to test
                String fullPrologString = GetPrologActionsString();
                listOfAllPossibleActions = GetAllPossibleActions(fullPrologString);
                break;

            case PlayabilityCheckMode.RandomCheck:
                listOfAllPossibleActions = new List <Action>()
                {
                    RandomPlayabilityGenerator.GetNewRandomAction()
                };
                break;

            default:
                throw new ArgumentOutOfRangeException("checkMode");
            }
            return(listOfAllPossibleActions);
        }