Exemplo n.º 1
0
Arquivo: Board.cs Projeto: bdr27/c-
        public Board()
        {
            int nextID = 1;
            cells = new Cell[BOARD_HEIGHT, BOARD_WIDTH];
            for (int i = 0; i < BOARD_HEIGHT; i++)
            {
                for (int j = 0; j < BOARD_WIDTH; j++)
                {
                    cells[i, j] = new Cell()

                    {
                        row = i,
                        col = j,
                        ID = nextID++,
                        piece = Piece.EMPTY
                    };
                }
            }
            setupMoveLocations();

        }
Exemplo n.º 2
0
Arquivo: Cell.cs Projeto: bdr27/c-
 public Cell()
 {
     topLeft = topRight = bottomLeft = bottomRight = null;
 }
Exemplo n.º 3
0
Arquivo: Board.cs Projeto: bdr27/c-
        private bool moveableCell(Cell start, Cell end)
        {
            List<Cell> movableLocations = new List<Cell>();
            movableLocations.Add(start.bottomLeft);
            movableLocations.Add(start.bottomRight);
            movableLocations.Add(start.topRight);
            movableLocations.Add(start.topLeft);

            foreach (Cell cell in movableLocations)
            {
                try
                {
                    if (cell.Equals(end))
                    {
                        return true;
                    }
                }
                catch (NullReferenceException)
                {
                    Debug.WriteLine("Out of range");
                }
            }
            return false;

        }