예제 #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (GameOfLife game = new GameOfLife())
     {
         game.Run();
     }
 }
예제 #2
0
        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);
                }
            }
        }
예제 #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 ();
        }
예제 #4
0
 public void ZelleMitZweiNachbarnUeberlebt()
 {
     int AnzahlNachbarn = 2;
     GameOfLife myGameOfLife = new GameOfLife(AnzahlNachbarn);
     Assert.AreEqual(true, myGameOfLife.ZelleUeberlebt());
 }
예제 #5
0
 public void ZelleMit1NachbarnStirbt()
 {
     int AnzahlNachbarn = 1;
     GameOfLife myGameOfLife = new GameOfLife(AnzahlNachbarn);
     Assert.AreEqual(false, myGameOfLife.ZelleUeberlebt());
 }