/// <summary> /// Read a board from a string. /// The string must have the dealer and vulnerability on the first line /// E,Both /// s 753 /// h KT53 /// d T654 /// c K6 /// s T984 s AKQJ62 /// h 842 h AQ7 /// d AQ d 3 /// c AQJ7 c 543 /// s /// h J96 /// d K9872 /// c T982 /// </summary> public Board2(string diagram) { if (diagram == null) { throw new ArgumentNullException("diagram"); } this.theDistribution = new Distribution(); this.results = new Collection <BoardResult>(); string[] lines = diagram.Replace("\r", "").Replace("\t", " ").Split('\n'); string[] contract = lines[0].Split(','); ParseSuit(lines[01].Trim(), Seats.North); ParseSuit(lines[02].Trim(), Seats.North); ParseSuit(lines[03].Trim(), Seats.North); ParseSuit(lines[04].Trim(), Seats.North); ParseSuit(lines[09].Trim(), Seats.South); ParseSuit(lines[10].Trim(), Seats.South); ParseSuit(lines[11].Trim(), Seats.South); ParseSuit(lines[12].Trim(), Seats.South); ParseSuit(lines[05].Substring(00, 17).Trim(), Seats.West); ParseSuit(lines[06].Substring(00, 17).Trim(), Seats.West); ParseSuit(lines[07].Substring(00, 17).Trim(), Seats.West); ParseSuit(lines[08].Substring(00, 17).Trim(), Seats.West); ParseSuit(lines[05].Substring(17).Trim(), Seats.East); ParseSuit(lines[06].Substring(17).Trim(), Seats.East); ParseSuit(lines[07].Substring(17).Trim(), Seats.East); ParseSuit(lines[08].Substring(17).Trim(), Seats.East); this.theDealer = SeatsExtensions.FromXML(contract[0].Trim()); this.theVulnerability = VulnerableConverter.FromXML(contract[1].Trim()); }
public Board2(int boardNumber) : this() { this.theDealer = SeatsExtensions.DealerFromBoardNumber(boardNumber); this.theVulnerability = VulnerableConverter.FromBoardNumber(boardNumber); this.theBoardNumber = boardNumber; this.theDistribution.DealRemainingCards(ShufflingRequirement.Random); }