本文整理汇总了C#中Game.Evolve方法的典型用法代码示例。如果您正苦于以下问题:C# Game.Evolve方法的具体用法?C# Game.Evolve怎么用?C# Game.Evolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game
的用法示例。
在下文中一共展示了Game.Evolve方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmptyWorldWithNoCellsShouldGenerateEmptyWorldWithNoCellsAfterTick
public void EmptyWorldWithNoCellsShouldGenerateEmptyWorldWithNoCellsAfterTick()
{
var sut = new Game();
sut.CurrentWorld = new World();
var result = sut.Evolve();
Assert.That(result.IsEmpty, Is.EqualTo(true));
}
示例2: WorldWithOneCellShouldGenerateEmptyWorldAfterTick
public void WorldWithOneCellShouldGenerateEmptyWorldAfterTick()
{
var sut = new Game();
var location = new Location();
sut.CurrentWorld.PlaceCell(location);
World result = sut.Evolve();
Assert.That(result.IsEmpty, Is.EqualTo(true));
}
示例3: TestOneCellDiesAfterEvolution
public void TestOneCellDiesAfterEvolution()
{
Game game = new Game(5,5, new List<string>() {"0,0"});
game.Evolve();
Assert.AreEqual(0, game.LiveCellsCount());
}
示例4: TestCellWithThreeLiveNeighboursRespawns
public void TestCellWithThreeLiveNeighboursRespawns()
{
Game game = new Game(
5,5, new List<string>()
{"0,0", "0,1", "1,0"});
game.Evolve();
Assert.AreEqual(4, game.LiveCellsCount());
}
示例5: TestCellWithMoreThanCellLiveNeighboursDies
public void TestCellWithMoreThanCellLiveNeighboursDies()
{
Game game = new Game(
5,5, new List<string>()
{"0,0", "1,0", "1,1","2,0","2,1"});
game.PrintTable();
game.Evolve();
game.PrintTable();
Assert.AreEqual(2, game.LiveCellsCount());
}
示例6: WorldWithThreeCellsNextToEachotherShouldGenerateWorldWithThreeCellAfterTick
public void WorldWithThreeCellsNextToEachotherShouldGenerateWorldWithThreeCellAfterTick()
{
var sut = new Game();
var location1 = new Location(1, 1);
var location2 = new Location(1, 2);
var location3 = new Location(1, 3);
var location4 = new Location(0, 2);
var location5 = new Location(2, 2);
sut.CurrentWorld.PlaceCell(location1);
sut.CurrentWorld.PlaceCell(location2);
sut.CurrentWorld.PlaceCell(location3);
World result = sut.Evolve();
Assert.That(result.ContainsCellAt(location1), Is.EqualTo(false));
Assert.That(result.ContainsCellAt(location2), Is.EqualTo(true));
Assert.That(result.ContainsCellAt(location3), Is.EqualTo(false));
Assert.That(result.ContainsCellAt(location4), Is.EqualTo(true));
Assert.That(result.ContainsCellAt(location5), Is.EqualTo(true));
}