Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Bulls and Cows Game in PYTHON We will use numbers as the secret. The number of d

ID: 3607145 • Letter: B

Question

Bulls and Cows Game in PYTHON

We will use numbers as the secret.

The number of digits will be a parameter in your program.

You may want to read up a bit on object oriented programming. We want to use object oriented design in the program.

The assignment is to write a program that will play the game with a human opponent and with a computer algorithm as the opponent.

*NOTE* cow - a digit that belongs to the secret number, but is in the wrong position, bull - a digit that belongs to the secret number and is in the correct position

EXAMPLE: the secret number is 1234. The number (guess) 5678 would result in 0 cows and 0 bulls. The guess 1567 would result in 0 cows and 1 bull (1 is in the secret number and in the correct position). The guess 1562 would result in 1 cow (the digit 2 is in the secret number but in the wrong position) and 1 bull (the digit 1). Similarly, the guess 1324 would result in 2 cows (3,2) and 2 bulls (1,4). Thus, you win the game when you guess all 4 digits correctly in the right position ( 0 cows, 4 bulls).

Explanation / Answer

cows-and-bulls.py

Dr Jack
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote