Beispiel #1
0
Datei: Board.cs Projekt: 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];
            }
        }
Beispiel #2
0
Datei: Cell.cs Projekt: bdr27/c-
 public Cell(int ID)
 {
     above = below = left = right = null;
     this.ID = ID;
 }
Beispiel #3
0
Datei: Cell.cs Projekt: bdr27/c-
 public Cell()
 {
     above = below = left = right = null;
 }