Пример #1
0
        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            Pieces pieces = game.PlacePieces(e.X, e.Y);

            this.Controls.Add(pieces);
            if (game.Winner == PiecesType.BLACK)
            {
                MessageBox.Show("黑色獲勝");
                this.Close();
            }

            else if (game.Winner == PiecesType.WHITE)
            {
                MessageBox.Show("白色獲勝");
                this.Close();
            }
        }
Пример #2
0
        public Pieces PlacePieces(int x, int y)
        {
            Pieces pieces = board.PlacePieces(x, y, currentPlayer);

            if (pieces != null)
            {
                CheckWinner();

                if (currentPlayer == PiecesType.BLACK)
                {
                    currentPlayer = PiecesType.WHITE;
                }
                else if (currentPlayer == PiecesType.WHITE)
                {
                    currentPlayer = PiecesType.BLACK;
                }
                return(pieces);
            }
            return(null);
        }