本文整理汇总了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;
}
}
示例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;
}
}
示例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());
}
}
}
示例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();
}
示例5: TestGameEngineMove
public void TestGameEngineMove()
{
var engine = new GameEngine(4, 4);
engine.InitializeGame("0100101001");
engine.Move(1);
}
示例6: TestInitializeGame
public void TestInitializeGame()
{
var engine = new GameEngine(4, 4);
engine.InitializeGame("1010010100101001");
}
示例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());
}