Exemple #1
0
        public void TestOscillationStateBlinker()
        {
            var blinker = new GameBoard(new InitialState(File.ReadAllText("Blinker.csv")));
            var snapShot1 = blinker.Grid;

            blinker.Evolve();
            Assert.IsFalse(AreStatesEqual(snapShot1, blinker.Grid)); //Assert that states have changed

            blinker.Evolve();
            Assert.IsTrue(AreStatesEqual(snapShot1, blinker.Grid)); //Assert that states have changed back to original position
        }
Exemple #2
0
        public void TestStillStateBlock()
        {
            var gameBoard = new GameBoard(new InitialState(File.ReadAllText("Block.csv")));
            var snapShot = gameBoard.Grid;
            gameBoard.Evolve();

            Assert.IsTrue(AreStatesEqual(snapShot, gameBoard.Grid));
        }
Exemple #3
0
        public void TestRandomStateChange()
        {
            var gameBoard = new GameBoard(new InitialState(File.ReadAllText("Arbitrary.csv")));
            var snapShot = gameBoard.Grid;
            gameBoard.Evolve();

            Assert.IsFalse(AreStatesEqual(snapShot, gameBoard.Grid));
        }
Exemple #4
0
        static void Main()
        {
            var gameBoard = new GameBoard(new InitialState(File.ReadAllText("Input.csv")));

            while (gameBoard.Generation < 100)
            {
                Console.Clear();
                Console.WriteLine("Genration " + gameBoard.Generation);

                gameBoard.Draw();
                Thread.Sleep(500);

                gameBoard.Evolve();

            }
        }