コード例 #1
0
        //RegisterLifeGrid
        public void RegisterLifeGrid(ILifeGrid grid)
        {
            int i, j;

            for (i = Y - 1; i <= Y + 1; i++)
            {
                for (j = X - 1; j <= X + 1; j++)
                {
                    if (i != -1 && i != grid.Width && j != grid.Height && j != -1 && !(i == Y && j == X))
                    //if (i != -1 && j != grid.Width && i != grid.Height && j != -1 && !(j == X && i == Y))
                    {
                        this.OnChange += new LifeCellEventHandler(grid[j, i].updateAliveNeighboursNum);
                    }
                }
            }

            grid.OnPersistState += new LifeGridEventHandler(this.cellStatusInNextGeneration);

            grid.OnNewGeneration += new LifeGridEventHandler(this.calculateNewGeneration);
        }
コード例 #2
0
 public GOLGridControl(ILifeGrid grid)
     : this()
 {
     Grid = grid;
 }