Exemple #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            gameOfLife  = new GameOfLife(graphics.PreferredBackBufferWidth / config.PixelSize, graphics.PreferredBackBufferHeight / config.PixelSize, config.Density, config.Reproductors, config.Survivors);
            spriteBatch = new SpriteBatch(GraphicsDevice);
            cell        = new Texture2D(graphics.GraphicsDevice, 1, 1);
            cell.SetData(new Color[] { Color.White });
        }
Exemple #2
0
        public static void Main()
        {
            Console.WriteLine("What type of the game you prefer?\n" +
                              "Write \"1\" to set lonely glider\n" +
                              "Write not \"1\" to set chaos on the screen\n");

            int.TryParse(Console.ReadLine(), out var gameType);
            Console.Clear();

            Console.WriteLine("Input size of map\n");
            if (!int.TryParse(Console.ReadLine(), out var gameSize))
            {
                Console.Clear();
                Console.WriteLine("This is not a size!\n" +
                                  "will be set default size : 10");
                gameSize = 10;
                Thread.Sleep(1500);
            }

            if (gameSize < 3)
            {
                Console.Clear();
                Console.WriteLine("Size is too small for game of life\n" +
                                  "it will be set default size : 10");
                gameSize = 10;
                Thread.Sleep(1500);
            }
            Console.Clear();

            var gameOfLife = new GameOfLife(gameSize);

            gameOfLife.SetGameMapType(gameType);
            gameOfLife.Start();
            Console.WriteLine("Press enter to exit");
            Console.ReadLine();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            GameOfLife gameOfLife = new GameOfLife();

            gameOfLife.Start();
        }