Exemple #1
0
        private void playADeal()
        {
            spades.addBid(getAITurn().getBid(spades));
            spades.addBid(getAITurn().getBid(spades));
            spades.addBid(getAITurn().getBid(spades));
            spades.addBid(getAITurn().getBid(spades));

            for (int i = 0; i < 13; i++)
            {
                spades.playCard(getAITurn().drawCard(spades));
                spades.playCard(getAITurn().drawCard(spades));
                spades.playCard(getAITurn().drawCard(spades));
                spades.playCard(getAITurn().drawCard(spades));

                spades.startNextBook();
            }
            spades.calculateAndStoreResults();
            spades.startNextDeal();
        }
Exemple #2
0
        public bool testBidding()
        {
            initVariables();

            for (int i = 0; i < 4; i++)
            {
                if (spades.hasBid(i))
                {
                    throw new Exception("BIDDING TEST");
                }
            }

            int        turnStart = spades.getPlayerTurn();
            List <int> bids      = new List <int>();

            for (int i = 1; i <= 4; i++)
            {
                int theBid = Utils.Instance.rnd.Next(10, 1532);
                bids.Add(theBid);
                spades.addBid(theBid);
            }

            if (spades.getPlayerTurn() != turnStart)
            {
                throw new Exception("BIDDING TEST");
            }
            if (spades.isBidPhase())
            {
                throw new Exception("BIDDING TEST");
            }

            for (int i = 0; i < 4; i++)
            {
                if (spades.players[(turnStart + i) % 4].getBid() != bids[i])
                {
                    throw new Exception("BIDDING TEST");
                }
            }

            return(true);
        }