/// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (GameOfLife game = new GameOfLife())
     {
         game.Run();
     }
 }
        public Field(int width, int height, int cellLength, Texture2D cell, int offset, int interval, GameOfLife main)
        {
            this.width = width;
            this.height = height;
            this.cellLength = cellLength;
            this.offset = offset;
            this.main = main;
            changedCells = new Queue<Cell>();
            pq = new PseudoQueue<Cell>();
            WidthInCells = width;
            HeightInCells = height;
            Interval = interval;
            Bounds = new Rectangle(offset, offset, width * cellLength, height * cellLength);

            CellTexture = cell;
            field = new Cell[width,height];

            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    field[i, j] = new Cell(i * cellLength + offset, j * cellLength + offset, cellLength);
                }
            }
        }
Exemple #3
0
        private void ReinitBoard(int percentage)
        {
            game = new GameOfLife ((int)width.Value, (int)height.Value, percentage, new GameRule (rule.Text));
            Text = "Game of Life - " + game.ToString ();

            gameBox.Invalidate ();
        }
 public void ZelleMitZweiNachbarnUeberlebt()
 {
     int AnzahlNachbarn = 2;
     GameOfLife myGameOfLife = new GameOfLife(AnzahlNachbarn);
     Assert.AreEqual(true, myGameOfLife.ZelleUeberlebt());
 }
 public void ZelleMit1NachbarnStirbt()
 {
     int AnzahlNachbarn = 1;
     GameOfLife myGameOfLife = new GameOfLife(AnzahlNachbarn);
     Assert.AreEqual(false, myGameOfLife.ZelleUeberlebt());
 }