Exemplo n.º 1
0
        private void initBoard()
        {
            for (int i = 0; i < 26; i++)
            {
                Cells[i] = new CellOnBoard();
            }


            //O and 25 is out of game
            Cells[1]  = new CellOnBoard(2, CheckerColor.Red);
            Cells[6]  = new CellOnBoard(5, CheckerColor.Black);
            Cells[8]  = new CellOnBoard(3, CheckerColor.Black);
            Cells[12] = new CellOnBoard(5, CheckerColor.Red);
            Cells[13] = new CellOnBoard(5, CheckerColor.Black);
            Cells[17] = new CellOnBoard(3, CheckerColor.Red);
            Cells[19] = new CellOnBoard(5, CheckerColor.Red);
            Cells[24] = new CellOnBoard(2, CheckerColor.Black);
            //for(int i = 1; i < 25; i++)
            //{
            //    Cells[i]= new CellOnBoard(5, CheckerColor.Black);
            //}
        }
Exemplo n.º 2
0
 public void AddCheckerToBoard(int cellNumber, CheckerColor color)
 {
     if (Cells[cellNumber].NumOfCheckers == 0)
     {
         Cells[cellNumber] = new CellOnBoard(1, color);
     }
     else if (Cells[cellNumber].CheckersColor != color && Cells[cellNumber].NumOfCheckers == 1)
     {
         Cells[cellNumber] = new CellOnBoard(1, color);
         if (color == CheckerColor.Black)
         {
             GameBar.AddRedToBar();
         }
         else
         {
             GameBar.AddBlackToBar();
         }
     }
     else
     {
         Cells[cellNumber].NumOfCheckers++;
     }
 }