Ejemplo n.º 1
0
        public Deal(string format)
        {
            playedCards = new LinkedList <Card>();
            lastTrick   = new LinkedList <Card>();
            string[] data = format.Split(" ");
            id   = int.Parse(data[0]);
            deck = new Deck(data[1]);
            int idx = 0;

            foreach (string s in data[2].Split("."))
            {
                if (s == "")
                {
                    continue;
                }
                playedCards.AddLast(deck.cards[int.Parse(s)]);
                if (idx + (data[2].Split(".").Length % 4) >= data[2].Split(".").Length)
                {
                    lastTrick.AddLast(deck.cards[int.Parse(s)]);
                }
                idx++;
            }
            bidding  = new Bidding(data[3]);
            contract = bidding.getContract(id);
            string[] ints = data[4].Split(".");
            NSTricks = int.Parse(ints[0]);
            EWTricks = int.Parse(ints[1]);
            setPlayerOnTurn(int.Parse(ints[2]));
        }
Ejemplo n.º 2
0
 /// <summary> Checks if the bidding is over, then gets the contract and sets the player on turn </summary>
 public void enterPlay()
 {
     if (!bidding.isBiddingOver())
     {
         Console.WriteLine("Error: Tried to exit bidding stage while bidding is not yet over");
         return;
     }
     contract = bidding.getContract(id);
     setPlayerOnTurn((contract.getDeclarer() + 1) % 4);
 }