Esempio n. 1
0
File: Board.cs Progetto: bdr27/c-
        public Board()
        {
            //create cell objects
            int nextID = 1;
            cells = new Cell[3, 3];
            for (int i = 0; i < 3; ++i)
            {
                for (int j = 0; j < 3; ++j)
                {
                    cells[i, j] = new Cell()
                    {
                        row = i,
                        col = j,
                        ID = nextID++,
                        
                    };
                    cells[i, j].setupCells();
                }
            }

            // setup above/below neighbourhood information for top & bottom rows
            for (int j = 0; j < 3; ++j)
            {
                cells[0, j].below = cells[1, j];
                cells[2, j].above = cells[1, j];
            }

            // setup neighbourhood information for middle row
            for (int j = 0; j < 3; ++j)
            {
                cells[1, j].above = cells[0, j];
                cells[1, j].below = cells[2, j];
            }
        }
Esempio n. 2
0
File: Cell.cs Progetto: bdr27/c-
 public Cell(int ID)
 {
     above = below = left = right = null;
     this.ID = ID;
 }
Esempio n. 3
0
File: Cell.cs Progetto: bdr27/c-
 public Cell()
 {
     above = below = left = right = null;
 }