Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Python programming to play 'bulls and cows' game/ computer guesses the number) Hello every one Here is my question! I should write a program to

(Python programming to play 'bulls and cows' game/ computer guesses the number)

Hello every one

Here is my question!

I should write a program to play Bulls and Cows!!

Host(human player) should think about the secret number and the program should guess. Host should give hints to the program.

1. You are free to implement your program for 3-digit in python.

2. In the beginning of each game, indicate to the host(human player) the number of digits your program is designed to guess.

3. Inform the host to choose a secret number with no repeated digits and have it written down somewhere.

4. Prompt host to start the game(the program)

5. Your program as game-player starts to guess, after each guess, prompt host for feedback as described in the Overview session: a. How many correct digits?[ex) if the secret number is 1234 and the guessed number is 4719, 2 corrects] b. How many exact digits? (skip this question if Correct is 0)[(ex0)if the seceret number is 1234 and the guesed number is 1538, 2 exact]

6. Your program is required to verify the responses returned by the host. If needed, repeatedly prompt host to re-enter the correct information, such examples as: a. Non-numeric responses b. Value of Exact is greater than that of Correct c. Value of either Correct or Exact should be less than the length of the secret number (3 or 4) d. Inconsistent responses

7. Feedback History a. Keep a list of history of all guesses including corresponding feedback, and then displaythe entire list after each guess in chronological order

8. Termination a. the current guess matches the secret number i. In this case, display a congratulation message b. the number of guess attempts reaches the limit i. Display a game-over message c. the host enters x on any of the 2 feedback (Correct or Exact)

9. Termination Prompt a. After termination, prompt host to quit or to continue a new game.

10. Game Startup a. Show a welcome message to briefly describe what your program does b. Then prompt host for the secret number prior to starting the game

11. For 3-digit number implementation, your program MUST successfully guessed the secret number within '20' attempts.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

More Books

Students also viewed these Databases questions

Question

Whats the difference between line art and halftones?

Answered: 1 week ago