コード例 #1
0
ファイル: Score.cs プロジェクト: whitemanthedj/BridgeBackEnd
        public void PrintScoreCard()
        {
            int start = (we.AboveRecord().Count > they.AboveRecord().Count ? we.AboveRecord().Count : they.AboveRecord().Count);

            Console.WriteLine("WE   | THEY");
            Console.WriteLine("     |     ");

            for (int i = start - 1; i >= 0; i--)
            {
                string weString   = (i < we.AboveRecord().Count ? we.AboveRecord()[i] : "");
                string theyString = (i < they.AboveRecord().Count ? they.AboveRecord()[i] : "");

                Console.WriteLine("{0, -5}|{1, -5}", weString, theyString);
            }


            int below = (we.BelowRecord().Count > they.BelowRecord().Count ? we.BelowRecord().Count : they.BelowRecord().Count);


            for (int i = 0; i < below; i++)
            {
                string weString   = (i < we.BelowRecord().Count ? we.BelowRecord()[i] : "    ");
                string theyString = (i < they.BelowRecord().Count ? they.BelowRecord()[i] : "");

                Console.WriteLine("{0, -5}|{1, -5}", weString, theyString);
            }
        }
コード例 #2
0
ファイル: Score.cs プロジェクト: whitemanthedj/BridgeBackEnd
 private static void HandleScores(PartnerScore bidders, PartnerScore opponent, Bid finalContract, int netTricks)
 {
     if (ContractWasMade(netTricks))
     {
         // bidders got enough triks
         bidders.addScore(netTricks, finalContract.TricksNeeded() - book, finalContract, bidders.Vulnerable());
     }
     else
     {
         // bidders went down tricks
         opponent.addScore(Math.Abs(netTricks), bidders.Vulnerable(), finalContract);
     }
     if (bidders.GotGame())
     {
         int increase = (bidders.BelowRecord().Count > opponent.BelowRecord().Count ? bidders.BelowRecord().Count: opponent.BelowRecord().Count);
         // Use that to increase the the count of both scores by ^
         bidders.GetAGame(increase);
         opponent.UpdateAboveLine(increase);
     }
 }