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; }
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; }
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; }
public void NextCard(Card Card, ContractColor ContractColor) { CardList.Add(Card); if (CardList.Count == 4) { SetWinner(ContractColor); } }
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; } } }
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); }
public void DeclareContractColor(ContractColor ContractColor) { ContractCache.ContractColor = ContractColor; ContractCache.XEnabled = false; ContractCache.XXEnabled = false; }