本文整理汇总了C#中World.PlaceCell方法的典型用法代码示例。如果您正苦于以下问题:C# World.PlaceCell方法的具体用法?C# World.PlaceCell怎么用?C# World.PlaceCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.PlaceCell方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldGetNeighborsOfCell
public void ShouldGetNeighborsOfCell()
{
var sut = new World();
var loc = new Location(1, 1);
sut.PlaceCell(loc);
sut.PlaceCell(new Location(1, 2));
var result = sut.GetNeighborsOfLocation(loc);
Assert.That(result, Is.EqualTo(1));
}
示例2: EvolveCells
private void EvolveCells(World newWorld)
{
foreach (var item in CurrentWorld.OccupiedLocations)
{
var neighbors = CurrentWorld.GetNeighborsOfLocation(item);
if (_livingLifeEngine.DetermineState(neighbors)) newWorld.PlaceCell(item);
EvolveDeadCellsAroundLivingCell(newWorld, item);
}
}
示例3: EvolveDeadCellsAroundLivingCell
private void EvolveDeadCellsAroundLivingCell(World newWorld, Location livingLocation)
{
var unoccupiedLocations = _neighborGenerator.GenerateNeighbors(livingLocation, CurrentWorld.OccupiedLocations);
foreach (var subitems in unoccupiedLocations)
{
var unOccupiedNeighbors = CurrentWorld.GetNeighborsOfLocation(subitems);
if (_deadLifeEngine.DetermineState(unOccupiedNeighbors)) newWorld.PlaceCell(subitems);
}
}
示例4: ShouldNotBeEmptyAfterCellIsPlacedInWorld
public void ShouldNotBeEmptyAfterCellIsPlacedInWorld()
{
var sut = new World();
sut.PlaceCell(new Location());
Assert.That(sut.IsEmpty, Is.EqualTo(false));
}