Beispiel #1
0
        public void Game_RightConfig_GameStateIsNotWrongConfig()
        {
            Game game = new Game(new MockGameConfig("right"), new MockGameDisplay());

            game.Run();

            Assert.AreEqual(game.State, Game.GameStateNormal);
        }
Beispiel #2
0
        public void Game_NullConfig_GameStateIsWrongConfig()
        {
            Game game = new Game(null, new MockGameDisplay());

            game.Run();

            Assert.AreEqual(game.State,Game.GameStateWrongConfig);
        }
Beispiel #3
0
        public void Game_NullDisplay_GameStateIsWrongDisplay()
        {
            Game game = new Game(new MockGameConfig("right"), null);

            game.Run();

            Assert.AreEqual(game.State, Game.GameStateWrongDisplay);
        }
Beispiel #4
0
        public void S03AC1_0_neighbor_becomes_dead()
        {
            MockGameDisplay display = new MockGameDisplay();
            Game game = new Game(new GameConfig("TestFiles\\story_03_AC1.conf"), display);

            game.Run();

            Assert.AreEqual(false, display.IsAlive(1, 1));
        }
Beispiel #5
0
        public void S01AC1_blankConfigure_displayerror()
        {
            GameConfig conf = new GameConfig("");
            Game game = new Game(conf, new MockGameDisplay());

            game.Run();

            Assert.AreEqual(game.State, Game.GameStateWrongConfig);
        }
Beispiel #6
0
        public void S03AC3_2_neighbors_becomes_live()
        {
            MockGameDisplay display = new MockGameDisplay();
            Game game = new Game(new GameConfig("TestFiles\\story_03_AC3.conf"), display);

            game.Run();

            Assert.AreEqual(false, display.IsAlive(0, 0));
            Assert.AreEqual(true, display.IsAlive(1, 1));
            Assert.AreEqual(false, display.IsAlive(2, 2));
        }
Beispiel #7
0
        public void S01AC2_RightConfigure_displayWorldOfRightSize()
        {
            GameConfig conf = new GameConfig("TestFiles\\Story_01.conf");
            GameDisplay display = new MockGameDisplay();
            Game game = new Game(conf, display);

            game.Run();

            Assert.AreEqual(game.State, Game.GameStateNormal);
            Assert.AreEqual(display.Width, 4);
            Assert.AreEqual(display.Height,5);
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                PrintUsage();
                return;
            }

            string configFileName = args[0];
            Game game = new Game(new GameConfig(configFileName), new GameDisplay());
            game.Run();
        }
Beispiel #9
0
        static void Main()
        {
            Game g = new Game(60, 30);

            // F-pentomino
            g.Set(26, 16);
            g.Set(27, 16);
            g.Set(25, 17);
            g.Set(26, 17);
            g.Set(26, 18);

            // Acorn

            /*g.Set(30, 15);
            *  g.Set(32, 16);
            *  g.Set(29, 17);
            *  g.Set(30, 17);
            *  g.Set(33, 17);
            *  g.Set(34, 17);
            *  g.Set(35, 17);*/

            // T

            /*g.Set(30, 15);
            *  g.Set(29, 16);
            *  g.Set(30, 16);
            *  g.Set(31, 16);*/

            // Glider

            /*g.Set(5, 5);
            *  g.Set(6, 6);
            *  g.Set(4, 7);
            *  g.Set(5, 7);
            *  g.Set(6, 7);*/

            // Glider gun

            /*g.Set(2, 6);
             * g.Set(3, 6);
             * g.Set(2, 7);
             * g.Set(3, 7);
             * g.Set(14, 4);
             * g.Set(15, 4);
             * g.Set(13, 5);
             * g.Set(12, 6);
             * g.Set(12, 7);
             * g.Set(12, 8);
             * g.Set(13, 9);
             * g.Set(14, 10);
             * g.Set(15, 10);
             * g.Set(16, 7);
             * g.Set(17, 5);
             * g.Set(18, 6);
             * g.Set(18, 7);
             * g.Set(19, 7);
             * g.Set(18, 8);
             * g.Set(17, 9);
             * g.Set(22, 4);
             * g.Set(22, 5);
             * g.Set(22, 6);
             * g.Set(23, 4);
             * g.Set(23, 5);
             * g.Set(23, 6);
             * g.Set(24, 3);
             * g.Set(24, 7);
             * g.Set(26, 2);
             * g.Set(26, 3);
             * g.Set(26, 7);
             * g.Set(26, 8);
             * g.Set(36, 4);
             * g.Set(37, 4);
             * g.Set(36, 5);
             * g.Set(37, 5);*/

            g.Run();
        }