Example #1
0
        public piece PlaceAPiece(int x, int y)
        {
            piece piece = board.PlaceAPiece(x, y, currentPlayer);

            if (piece != null)
            {
                //check Win?
                CheckWinner();
                if (currentPlayer == PieceType.BLACK)
                {
                    currentPlayer = PieceType.WHITE;
                }
                else if (currentPlayer == PieceType.WHITE)
                {
                    currentPlayer = PieceType.BLACK;
                }
                return(piece);
            }
            return(null);
        }
Example #2
0
        public Piece PlaceAPiece(int x, int y)
        {
            Piece piece = board.PlaceAPiece(x, y, currentPlayer);

            if (piece != null)
            {
                //檢察是否現在下棋的人獲勝
                checkWinner();

                //交換選手
                if (currentPlayer == PieceType.BLACK)
                {
                    currentPlayer = PieceType.WHITE;
                }
                else if (currentPlayer == PieceType.WHITE)
                {
                    currentPlayer = PieceType.BLACK;
                }
                return(piece);
            }

            return(null);
        }
Example #3
0
        public Piece PlaceAPiece(int x, int y)
        {
            Piece piece = board.PlaceAPiece(x, y, currentPlayer);

            if (piece != null)
            {
                /// 檢查下棋者是否獲勝
                CheckWinner();

                /// 交換選手
                if (currentPlayer == PieceType.Black)
                {
                    currentPlayer = PieceType.White;
                }
                else
                {
                    currentPlayer = PieceType.Black;
                }
                return(piece);
            }

            return(null);
        }