public AuctionMapperTest() { _auction = new PBNAuction(); _auction.Auction = new Auction(Direction.North); Bid b = new Bid(); b.Pass = true; _auction.Auction.Bids.Add(b); b = new Bid(); b.Level = 2; b.Suit = Suit.Hearts; b.Explanation = 1; _auction.Auction.Bids.Add(b); b = new Bid(); b.Pass = true; _auction.Auction.Bids.Add(b); b = new Bid(); b.Level = 2; b.Suit = Suit.Notrump; b.Explanation = 2; _auction.Auction.Bids.Add(b); b = new Bid(); b.Pass = true; _auction.Auction.Bids.Add(b); b = new Bid(); b.Level = 3; b.Suit = Suit.Diamonds; b.Explanation = 3; _auction.Auction.Bids.Add(b); b = new Bid(); b.Pass = true; _auction.Auction.Bids.Add(b); b = new Bid(); b.Level = 4; b.Suit = Suit.Hearts; _auction.Auction.Bids.Add(b); b = new Bid(); b.Pass = true; _auction.Auction.Bids.Add(b); b = new Bid(); b.Pass = true; _auction.Auction.Bids.Add(b); b = new Bid(); b.Pass = true; _auction.Auction.Bids.Add(b); _auction.Auction.Explanations.Add("Weak"); _auction.Auction.Explanations.Add("Asking"); _auction.Auction.Explanations.Add("Strong with diamonds"); }
/* * public static Auction GetAuctionFromStream(InputStream identification) { * // TODO * return null; * } */ public static void AppendAuction(StringBuilder pbn, PBNAuction pbnAuction) { if (pbnAuction == null || pbnAuction.Auction == null || pbnAuction.Auction.Bids == null || pbnAuction.Auction.Bids.Count < 1) { return; } var auction = pbnAuction.Auction; PBNTagMapper.AppendTag(pbn, PBNAuction.Tags.Auction, auction.Dealer); int ix = 1; foreach (Bid b in auction.Bids) { pbn.Append(PBNBidMapper.GetstringFromBid(b)); if (ix == auction.Bids.Count) { pbn.Append('\n'); } else { if (ix % 4 == 0) { pbn.Append('\n'); } else { pbn.Append(' '); } } ix++; } ix = 1; foreach (string explanation in auction.Explanations) { PBNTagMapper.AppendTag(pbn, PBNAuction.Tags.Note, ix.ToString() + ":" + explanation); ix++; } }