Пример #1
0
        protected virtual void ChangeCellState(int x_old, int y_old, int x_new, int y_new, bool color, int num)
        {
            if (num == 1)
            {
                board[x_new, y_new] = new KeyVal <bool, Checker>(true, board[x_old, y_old].Checker);

                if (color == false)
                {
                    first_player.cells_taken   += 1;
                    board[x_old, y_old].Checker = new Checker(color, x_old * 80 + 33, y_old * 80 + 56, sender);
                }
                else
                {
                    second_player.cells_taken  += 1;
                    board[x_old, y_old].Checker = new Checker(color, x_old * 80 + 33, y_old * 80 + 56, sender);
                }

                CatchRivalCheckers(x_new, y_new, color);
            }
            else
            {
                board[x_new, y_new] = new KeyVal <bool, Checker>(true, board[x_old, y_old].Checker);
                board[x_old, y_old] = null;
                CatchRivalCheckers(x_new, y_new, color);
            }
        }
 public Player(bool color, ref KeyVal <bool, Checker>[,] board, int x, int y, object sender, bool pc_pl)
 {
     this.color = color;
     if (pc_pl == false)
     {
         board[x, y] = new KeyVal <bool, Checker>(true, new Checker(color, x * 80 + 33, y * 80 + 53, sender));
     }
     else
     {
         board[x, y] = new KeyVal <bool, Checker>(true, new CheckerPC(color, x * 80 + 33, y * 80 + 53, sender));
     }
     cells_taken = 1;
 }