当前位置: 首页>>代码示例>>C#>>正文


C# GameEngine.InitializeGame方法代码示例

本文整理汇总了C#中GameEngine.InitializeGame方法的典型用法代码示例。如果您正苦于以下问题:C# GameEngine.InitializeGame方法的具体用法?C# GameEngine.InitializeGame怎么用?C# GameEngine.InitializeGame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameEngine的用法示例。


在下文中一共展示了GameEngine.InitializeGame方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestStateArgumentExcptionUpperLimit

 public void TestStateArgumentExcptionUpperLimit()
 {
     try
     {
         var engine = new GameEngine(4, 4);
         engine.InitializeGame("11111111111111111");
     }
     catch (Exception exception)
     {
         Assert.AreEqual("Input length is not correct", exception.Message);
         throw;
     }
 }
开发者ID:hemant1906,项目名称:McK.Life,代码行数:13,代码来源:GameEngineTest.cs

示例2: TestStateArgumentException

 public void TestStateArgumentException()
 {
     try
     {
         var engine = new GameEngine(4, 4);
         engine.InitializeGame("1010010100101021");
     }
     catch (Exception exception)
     {
         Assert.AreEqual("Input should be in 011101 format", exception.Message);
         throw;
     }
 }
开发者ID:hemant1906,项目名称:McK.Life,代码行数:13,代码来源:GameEngineTest.cs

示例3: TestGameEngineRender

        public void TestGameEngineRender()
        {
            var engine = new GameEngine(4, 4);
            engine.InitializeGame("0100101001");
            using (var sw = new StringWriter())
            {
                Console.SetOut(sw);

                using (var sr = new StringReader(""))
                {
                    Console.SetIn(sr);

                    engine.Render();

                    string expected = string.Format(" #  {0}# # {1} #  {2}    {3}", Environment.NewLine,
                                                    Environment.NewLine, Environment.NewLine, Environment.NewLine);
                    Assert.AreEqual(expected, sw.ToString());
                }
            }
        }
开发者ID:hemant1906,项目名称:McK.Life,代码行数:20,代码来源:GameEngineTest.cs

示例4: RunGame

 private static void RunGame(GameEngine engine, string initialState, int generations)
 {
     engine.InitializeGame(initialState);
     Console.ForegroundColor = ConsoleColor.Red;
     for(int generation = 0; generation < generations ; generation++ )
     {
         Console.SetCursorPosition(0, 7);
         engine.Render();
         Thread.Sleep(500); // wait for half a second
         engine.Move(1);
     }
     Console.ResetColor();
 }
开发者ID:hemant1906,项目名称:McK.Life,代码行数:13,代码来源:Program.cs

示例5: TestGameEngineMove

 public void TestGameEngineMove()
 {
     var engine = new GameEngine(4, 4);
     engine.InitializeGame("0100101001");
     engine.Move(1);
 }
开发者ID:hemant1906,项目名称:McK.Life,代码行数:6,代码来源:GameEngineTest.cs

示例6: TestInitializeGame

 public void TestInitializeGame()
 {
     var engine = new GameEngine(4, 4);
     engine.InitializeGame("1010010100101001");
 }
开发者ID:hemant1906,项目名称:McK.Life,代码行数:5,代码来源:GameEngineTest.cs

示例7: TestGameGeneration

 public void TestGameGeneration()
 {
     var engine = new GameEngine(4, 4);
     engine.InitializeGame("1111111111111111");
     Assert.AreEqual(0, engine.GetCurrentGameGeneration());
     engine.Move(5);
     Assert.AreEqual(5, engine.GetCurrentGameGeneration());
 }
开发者ID:hemant1906,项目名称:McK.Life,代码行数:8,代码来源:GameEngineTest.cs


注:本文中的GameEngine.InitializeGame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。