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


C# Game.Evolve方法代码示例

本文整理汇总了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));
 }
开发者ID:MarkPearlCoZa,项目名称:Kata_ConwaysGameOfLife,代码行数:7,代码来源:GameTests.cs

示例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));
 }
开发者ID:MarkPearlCoZa,项目名称:Kata_ConwaysGameOfLife,代码行数:8,代码来源:GameTests.cs

示例3: TestOneCellDiesAfterEvolution

    public void TestOneCellDiesAfterEvolution()
    {
        Game game = new Game(5,5, new List<string>() {"0,0"});

        game.Evolve();

        Assert.AreEqual(0, game.LiveCellsCount());
    }
开发者ID:CodingDojo,项目名称:MUC_10_2011_life_zebra,代码行数:8,代码来源:UntitledTest.cs

示例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());
    }
开发者ID:CodingDojo,项目名称:MUC_10_2011_life_zebra,代码行数:10,代码来源:UntitledTest.cs

示例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());
    }
开发者ID:CodingDojo,项目名称:MUC_10_2011_life_zebra,代码行数:12,代码来源:UntitledTest.cs

示例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));
        }
开发者ID:MarkPearlCoZa,项目名称:Kata_ConwaysGameOfLife,代码行数:21,代码来源:GameTests.cs


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