Example #1
0
        private void SetWinner(ContractColor ContractColor)
        {
            Card      StrongestCard = CardList[0];
            PlayerTag CurrentWinner = StrongestCard.PlayerID;

            for (int i = 1; i <= 3; i++)
            {
                Card CurrentCard = CardList[i];
                if (CurrentCard.Color == StrongestCard.Color)
                {
                    if (CurrentCard.Figure > StrongestCard.Figure)
                    {
                        StrongestCard = CurrentCard;
                        CurrentWinner = StrongestCard.PlayerID;
                    }
                }
                else
                {
                    if ((int)(CurrentCard.Color) == (int)(ContractColor))
                    {
                        StrongestCard = CurrentCard;
                        CurrentWinner = StrongestCard.PlayerID;
                    }
                }
            }
            this.Winner = CurrentWinner;
        }
Example #2
0
 public Contract(ContractHeight ContractHeight, ContractColor ContractColor, PlayerTag DeclaredBy, bool XEnabled = false, bool XXEnabled = false)
 {
     this.ContractHeight = ContractHeight;
     this.ContractColor  = ContractColor;
     this.DeclaredBy     = DeclaredBy;
     this.XEnabled       = XEnabled;
     this.XXEnabled      = XXEnabled;
 }
Example #3
0
 public GameInfo(ContractColor ContractColor, PlayerTag Declarer)
 {
     this.CurrentPlayer = NextPlayer(Declarer);
     this.TrickList     = new List <Trick>();
     this.currentTrick  = new Trick();
     this.ContractColor = ContractColor;
     this.Declarer      = Declarer;
 }
Example #4
0
 public void NextCard(Card Card, ContractColor ContractColor)
 {
     CardList.Add(Card);
     if (CardList.Count == 4)
     {
         SetWinner(ContractColor);
     }
 }
Example #5
0
 private void SetColor(PlayerTag PlayerTag, ContractColor Color)
 {
     if (PlayerTag == PlayerTag.N || PlayerTag == PlayerTag.S)
     {
         if ((int)NS[(int)Color] == -1)
         {
             NS[(int)Color] = PlayerTag;
         }
     }
     if (PlayerTag == PlayerTag.E || PlayerTag == PlayerTag.W)
     {
         if ((int)WE[(int)Color] == -1)
         {
             WE[(int)Color] = PlayerTag;
         }
     }
 }
Example #6
0
        public string ToString()
        {
            string contractHeight = (int)ContractHeight == -1 ? "" : ((int)ContractHeight).ToString();
            string contractColor  = (int)ContractColor == -1 ? "" : ContractColor.ToString();
            string contractStr    = contractHeight + contractColor;

            if (XXEnabled)
            {
                contractStr += "XX";
            }
            else if (XEnabled)
            {
                contractStr += "X";
            }
            else if (contractStr == "")
            {
                contractStr = "pass";
            }
            return(contractStr);
        }
Example #7
0
 public void DeclareContractColor(ContractColor ContractColor)
 {
     ContractCache.ContractColor = ContractColor;
     ContractCache.XEnabled      = false;
     ContractCache.XXEnabled     = false;
 }