Пример #1
0
 /// <summary>
 /// Calls base constructor and passes arguments - not yet implemented
 /// </summary>
 /// <param name="numberOfPlayers"></param>
 /// <param name="deckSize"></param>
 /// <param name="difficulty"></param>
 /// <param name="isAllAI"></param>
 public PassingRules(int numberOfPlayers = MIN_PLAYERS, Deck.DeckSize deckSize = Deck.DeckSize.FIFTY_TWO,
                     ComputerPlayer.AIDifficulty difficulty = ComputerPlayer.AIDifficulty.Basic, bool isAllAI = false)
     : base(numberOfPlayers, deckSize, difficulty, isAllAI)
 {
     throw new NotImplementedException();
 }
Пример #2
0
 /// <summary>
 /// Default constructor calls durakgame's constructor and passes arguments
 /// </summary>
 /// <param name="numberOfPlayers"></param>
 /// <param name="deckSize"></param>
 /// <param name="difficulty"></param>
 /// <param name="isAllAI"></param>
 internal BasicRules(int numberOfPlayers = MIN_PLAYERS, Deck.DeckSize deckSize = Deck.DeckSize.FIFTY_TWO,
                     ComputerPlayer.AIDifficulty difficulty = ComputerPlayer.AIDifficulty.Basic, bool isAllAI = false)
     : base(numberOfPlayers, deckSize, difficulty, isAllAI)
 {
 }
Пример #3
0
        /// <summary>
        /// Default Constructor for the game of durak
        /// </summary>
        /// <param name="numberOfPlayers"></param>
        /// <param name="deckSize"></param>
        /// <param name="difficulty"></param>
        /// <param name="isAllAI"></param>
        internal DurakGame(int numberOfPlayers = MIN_PLAYERS, Deck.DeckSize deckSize = Deck.DeckSize.THIRTY_SIX,
                           ComputerPlayer.AIDifficulty difficulty = ComputerPlayer.AIDifficulty.Basic, bool isAllAI = false)
        {
            // validate the number of players
            if (numberOfPlayers < MIN_PLAYERS || numberOfPlayers > MAX_PLAYERS)
            {
                throw new ArgumentException("Number of players entered must be between "
                                            + MIN_PLAYERS + " and " + MAX_PLAYERS + " you entered "
                                            + numberOfPlayers.ToString(), "numberOfPlayers");
            }

            theDeckSize          = deckSize;
            this.numberOfPlayers = numberOfPlayers;
            isAiGame             = isAllAI;

            // If its an AI game load only AI's
            if (isAiGame)
            {
                for (int i = 0; i < numberOfPlayers; ++i)
                {
                    switch (difficulty)
                    {
                    case ComputerPlayer.AIDifficulty.Basic:
                        myPlayers.Add(new BasicAI(this));
                        break;

                    case ComputerPlayer.AIDifficulty.Advanced:
                        // add stuff here
                        throw new ArgumentOutOfRangeException("Advanced AI not implement yet");
                        break;

                    case ComputerPlayer.AIDifficulty.Cheater:
                        // add stuff here
                        throw new ArgumentOutOfRangeException("Cheating AI not implement yet");
                        break;
                    }

                    myPlayers[i].name = "Computer Player " + (i + 1);
                }
            }
            else // load the player and then the AI's
            {
                myPlayers.Add(new HumanPlayer(this, "Human Player"));

                for (int i = 1; i < numberOfPlayers; ++i)
                {
                    switch (difficulty)
                    {
                    case ComputerPlayer.AIDifficulty.Basic:
                        myPlayers.Add(new BasicAI(this));
                        break;

                    case ComputerPlayer.AIDifficulty.Advanced:
                        // add stuff here
                        throw new ArgumentOutOfRangeException("Advanced AI not implement yet");
                        break;

                    case ComputerPlayer.AIDifficulty.Cheater:
                        // add stuff here
                        throw new ArgumentOutOfRangeException("Cheating AI not implement yet");
                        break;
                    }
                }
            }

            // create a new deck
            myDeck = new Deck(theDeckSize);
            myDeck.shuffle();
            // set the trump card
            trumpCard = myDeck[0];

            // set game state and current attacking and defending players
            isAttacking     = true;
            currentPlayer   = 0;
            attackingPlayer = 0;
            defendingPlayer = 1;
        }