Game Development Reference
In-Depth Information
52. print(' Fermi One digit is correct and in the
right position.')
53. print(' Bagels No digit is correct.')
54.
55. while True:
56. secretNum = getSecretNum(NUMDIGITS)
57. print('I have thought up a number. You have %s guesses
to get it.' % (MAXGUESS))
58.
59. numGuesses = 1
60. while numGuesses <= MAXGUESS:
61. guess = ''
62. while len(guess) != NUMDIGITS or not isOnlyDigits
(guess):
63. print('Guess #%s: ' % (numGuesses))
64. guess = input()
65.
66. clue = getClues(guess, secretNum)
67. print(clue)
68. numGuesses += 1
69.
70. if guess == secretNum:
71. break
72. if numGuesses > MAXGUESS:
73. print('You ran out of guesses. The answer was
%s.' % (secretNum))
74.
75. if not playAgain():
76. break
Designing the Program
Here is a flow chart for this program. The flow chart describes the basic events of what
happens in this game, and in what order they can happen:
Search WWH ::




Custom Search