Skip to content

Commit b73c00c

Browse files
committed
Display call annotations
1 parent 00b755a commit b73c00c

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

bridgit/Display.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,43 @@ public static void Auction(Game game, bool showBidNumbers = false, IEnumerable<i
117117
col += 1;
118118
direction = direction.LeftHandOpponent();
119119
}
120-
foreach (var call in game.Auction.Calls)
120+
foreach (var annotatedCall in game.Auction)
121121
{
122122
if (invalidBids != null && invalidBids.Contains(bidIndex))
123123
{
124124
Console.ForegroundColor = ConsoleColor.Red;
125+
}
126+
else if (annotatedCall.HasNote)
127+
{
128+
Console.ForegroundColor = ConsoleColor.Blue;
125129
}
126-
Console.Write(showBidNumbers? $"{bidIndex, 2}:{call, -6}" : $"{call, -6}");
130+
Console.Write(showBidNumbers? $"{bidIndex, 2}:{annotatedCall.Call, -6}" : $"{annotatedCall.Call, -6}");
127131
Console.ResetColor();
128132
col ++;
129133
bidIndex ++;
130134
if (col % 4 == 0) Console.WriteLine();
131135
}
132136
if (col % 4 != 0) Console.WriteLine();
137+
if (game.Auction.Any(annotatedCall => annotatedCall.HasNote))
138+
{
139+
Console.WriteLine();
140+
Console.ForegroundColor = ConsoleColor.Blue;
141+
CallAnnotations(game);
142+
Console.ResetColor();
143+
}
144+
}
145+
146+
public static void CallAnnotations(Game game)
147+
{
148+
var bidIndex = 1;
149+
foreach (var annotatedCall in game.Auction)
150+
{
151+
if (annotatedCall.HasNote)
152+
{
153+
Console.WriteLine($"{bidIndex, 2}: {annotatedCall.Note}");
154+
}
155+
bidIndex++;
156+
}
133157
}
134158

135159
public static void AuctionTitles(Vulnerable vul, bool showBidNumbers)

0 commit comments

Comments
 (0)