Analyzing the results
You are back where you started, at line 66 in deal.c,
and at this point it helps to know two things about the game
of Bridge:
-
Bridge is a game for four players.
-
Fifty-two cards are dealt.
Each time a player receives cards, there are 13 cards less
in the pack to be dealt.
From the output produced by when, we can see that at each
line after the first, the number of cards is reduced by 13.
Therefore, we conclude that cardsleft indicates the
cards remaining after players receive cards, and that each time
a line is printed, the program is about to deal cards to a player.
Since five lines were printed, the program was trying to distribute
cards to five players, clearly an error.
Hence, it is likely that there is a loop somewhere that is out of
bounds.
Next topic:
Examining a different function
Previous topic:
Monitoring the contents of variables
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003