예제 #1
0
        private void handleComputerTurn()
        {
            CheckersLogic.Point startingComputerPoint    = null;
            CheckersLogic.Point destinationComputerPoint = null;
            r_LogicUnit.GetAnAIMove(ref startingComputerPoint, ref destinationComputerPoint); // make an AI move
            r_LogicUnit.PreformMove(startingComputerPoint, destinationComputerPoint);         // preform the move (no need to use the returned boolean value because the AI always choose valid moves)

            // check if either player has won, lost or its a tie
            manageTasksBeforeNextTurn();
        }
예제 #2
0
        private bool checkIfValidTurnAndPreformIt(int i_ColDestination, int i_RowDestination)
        {
            bool isValidTurn = false;

            CheckersLogic.Point startingPoint    = new CheckersLogic.Point(boardSquareActiveSquare.Row, boardSquareActiveSquare.Col);
            CheckersLogic.Point destinationPoint = new CheckersLogic.Point(i_RowDestination, i_ColDestination);
            if (r_LogicUnit.PreformMove(startingPoint, destinationPoint) == true)
            {
                isValidTurn = true;
            }
            else
            {
                MessageBox.Show(
                    @"Invalid move!
Please try again.",
                    this.Text);
                boardSquareActiveSquare.SetInActive();
                boardSquareActiveSquare = null;
            }

            return(isValidTurn);
        }