Exemplo n.º 1
0
        public OscilatorGame(GameType gameType, int maxGenerations)
            : base(maxGenerations)
        {
            Type = gameType;
            if (gameType == GameType.Blinker)
            {
                grid = new Grid(5, 5);
                grid.ToggleCell(2, 1, true);
                grid.ToggleCell(2, 2, true);
                grid.ToggleCell(2, 3, true);
            }

            if (gameType == GameType.Toad)
            {
                grid = new Grid(6, 6);
                grid.ToggleCell(2, 1, true);
                grid.ToggleCell(3, 1, true);
                grid.ToggleCell(4, 2, true);
                grid.ToggleCell(1, 3, true);
                grid.ToggleCell(2, 4, true);
                grid.ToggleCell(3, 4, true);
            }
            if (gameType == GameType.Beacon)
            {
                grid = new Grid(6, 6);
                grid.ToggleCell(1, 1, true);
                grid.ToggleCell(1, 2, true);
                grid.ToggleCell(2, 1, true);
                grid.ToggleCell(2, 2, true);
                grid.ToggleCell(3, 3, true);
                grid.ToggleCell(3, 4, true);
                grid.ToggleCell(4, 3, true);
                grid.ToggleCell(4, 4, true);
            }
            if (gameType == GameType.Pulsar)
            {
                grid = new Grid(17, 17);
                for (int i = 0; i < 17; i++)
                {
                    for (int j = 0; j < 17; j++)
                    {
                        if (i == 2 || i == 7 || i == 9 || i == 14)
                        {
                            if (j == 4 || j == 5 || j == 6 || j == 10 || j == 11 || j == 12)
                            {
                                grid.ToggleCell(i, j, true);
                            }
                        }
                        if ((i >= 4 && i <= 6) || (i >= 10 && i <= 12))
                        {
                            if (j == 2 || j == 7 || j == 9 || j == 14)
                            {
                                grid.ToggleCell(i, j, true);
                            }

                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 public SpaceShip(GameType gameType, int maxGenerations)
     : base(maxGenerations)
 {
     Type = gameType;
     if (gameType == GameType.Lightweight)
     {
         grid = new Grid(6, 20);
         grid.ToggleCell(2, 4, true);
         grid.ToggleCell(2, 5, true);
         grid.ToggleCell(3, 2, true);
         grid.ToggleCell(3, 3, true);
         grid.ToggleCell(3, 5, true);
         grid.ToggleCell(3, 6, true);
         grid.ToggleCell(4, 2, true);
         grid.ToggleCell(4, 3, true);
         grid.ToggleCell(4, 4, true);
         grid.ToggleCell(4, 5, true);
         grid.ToggleCell(5, 3, true);
         grid.ToggleCell(5, 4, true);
     }
 }
Exemplo n.º 3
0
        public StillLifeGame(GameType gameType, int maxGenerations)
            : base(maxGenerations)
        {
            Type = gameType;
            if (Type == GameType.Block)
            {
                grid = new Grid(4, 4);
                grid.ToggleCell(1, 1, true);
                grid.ToggleCell(1, 2, true);
                grid.ToggleCell(2, 1, true);
                grid.ToggleCell(2, 2, true);
            }

            if (Type == GameType.Beehive)
            {
                grid = new Grid(5, 6);
                grid.ToggleCell(1, 2, true);
                grid.ToggleCell(1, 3, true);
                grid.ToggleCell(2, 1, true);
                grid.ToggleCell(2, 4, true);
                grid.ToggleCell(3, 2, true);
                grid.ToggleCell(3, 3, true);
            }
        }