Ejemplo n.º 1
0
        /////////////////////////////////////////////////////////////////////////////////

        public piece placeapiece(int x, int y)
        {
            piece piece = board.placeapiece(x, y, current);

            if (piece != null)
            {
                //check have winner rightnow?
                checkwin();
                //switch player
                if (current == piecetype.BLACK)
                {
                    current = piecetype.WHITE;
                }
                else if (current == piecetype.WHITE)
                {
                    current = piecetype.BLACK;
                }
                return(piece);
            }
            return(null);
        }
Ejemplo n.º 2
0
 private void Form1_MouseDown(object sender, MouseEventArgs e)
 {
     if (finish == false)
     {
         piece piece = game.placeapiece(e.X, e.Y);
         if (piece != null)
         {
             this.Controls.Add(piece);
             //check anyone win?
             if (game.fwinner == piecetype.BLACK)
             {
                 MessageBox.Show(BlackPlayer_Name + " win");
                 finish = true;
             }
             else if (game.fwinner == piecetype.WHITE)
             {
                 MessageBox.Show(WhitePlayer_Name.Text + " win");
                 finish = true;
             }
         }
     }
 }