Example #1
0
        /// <summary>
        /// AI handler - responsible for the "AI" moves.
        /// Uses a HelpClass for this
        /// </summary>
        public void AIMoves()
        {
            // Call the function to make an AI move.
            AIMove.Move(ExtractDataOfField(), this.Controls, currentPlayer.ToString());

            // Makes the neccessary changes to the local values.
            currentPlayer = EnumLook.Next(currentPlayer);
            usedBricks++;
        }
Example #2
0
        /// <summary>
        /// This is the handler that will "place" a brick on the playfield
        /// It will run thruogh the nessasary checks before placing
        /// </summary>
        private void PlaceBrick()
        {
            // Handles if no bricks left
            if (noBricks == true)
            {
                if (fieldEmpty == true)
                {
                    AddLogEntry("You are not out of bricks. Click on a brick to move.");
                    return;
                }
                else
                {
                    RemoveBrick();
                }
            }
            // Places a brick based on who turn it is
            else
            {
                // Checks if the field is empty. If not return without action
                if (fieldEmpty == false)
                {
                    AddLogEntry("This field is taken! Place click on an empty field.");
                    return;
                }

                // Place a brick based on turn
                bt.Text = currentPlayer.ToString();

                // Next player
                currentPlayer = EnumLook.Next(currentPlayer);
                usedBricks++;

                // If simple version is on - disables the button
                if (advancedVersion == false)
                {
                    bt.Enabled = false;
                }
            }
        }