コード例 #1
0
    static public void Main()
    {
        int      height   = 20;
        int      width    = 40;
        Lifegame lifegame = new Lifegame(height, width);

        lifegame.Loop();
    }
コード例 #2
0
        public void UpdateTest_Blinker()
        {
            // 以下のような配置
            //□□□		□■□
            //■■■   =>	□■□
            //□□□		□■□
            int size = 3;
            Position[] livingCells = new Position[] { new Position(new [] { 1, 0 }), new Position(new [] { 1, 1 }), new Position(new [] { 1, 2 }) };
            Lifegame target = new Lifegame(size, livingCells);
            string expected = "\r\n□■□\r\n□■□\r\n□■□";

            string actual;
            target.Update();
            actual = target.ToString();
            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void UpdateTest_Blinker()
        {
            // 以下のような配置
            //□□□		□■□
            //■■■   =>	□■□
            //□□□		□■□
            int size = 3;

            Position[] livingCells = new Position[] { new Position(new [] { 1, 0 }), new Position(new [] { 1, 1 }), new Position(new [] { 1, 2 }) };
            Lifegame   target      = new Lifegame(size, livingCells);
            string     expected    = "\r\n□■□\r\n□■□\r\n□■□";

            string actual;

            target.Update();
            actual = target.ToString();
            Assert.AreEqual(expected, actual);
        }