Question

How to play Bulls and Cows between you (the host) and your computer (the player) When...

How to play Bulls and Cows between you (the host) and your computer (the player)

When completed, your program allows you to host the game (i.e., you create a secret word and score every guess) and it makes guesses until it wins. During the development or testing of your program, you may set a condition (e.g., the total count of guesses is already 10) to allow your program to request to reveal the secret word and quit the game.

In this player mode, your program should:

1. Display a total count of guesses with a new generated guess, which should be a 5-char string with '@' always included and the rest four characters drwan from any of the below 3 sets

characters:
{R, S, T, U, V }
{ 5, 6, 7, 8, 9 }
{ =, ?, %, @, $ }
2. Wait for a score (e.g., '2Bull3Cow') to be returned and entered by the host, who is you. It's suggested the score is entered on the same line of the the count and guess displayed in the above step. So, it would look like
    • Guess #3 8@XYZ   1Bull2Cow
    • Guess #4 5@WYZ   1Bull1Cow
    • Guess #5 @8=%Z 4Bull0Cow   
  1. Repeat the above two steps until the guess wins a score of '5Bull0Cow' as shown below.
    • Guess #3 8@XYZ   1Bull2Cow
    • Guess #4 5@WYZ   1Bull1Cow
    • Guess #5 @8=%Z 4Bull0Cow
    • Guess #6 @8=6Z 5Bull0Cow -- You win!!

Except for the very first guess, your program should implement a strategy or formula to generate a new guess based on all scores collected. A good strategy or formula should use as much as possible the information or hints provided by the scores to quickly approach the secret word. This would be the most challenging component to be implemented in the entire program.

As a clue for everyone, one possible method is to generate a list of all possible secret words (using all scores returned) that could be the next guess, then to prune the list by keeping only those words that would give an equivalent score to how the last guess was scored. Then, the next guess can be any word from the pruned list. Either the guess correctly hits the secret word or run out of words to guess, which indicates a problem with the scoring or a problem with the list itself.


Programming language: Java
0 0
Add a comment Improve this question Transcribed image text
Answer #1

There are total 4 classes. Student class is inherited and publicly accessed by 2 more classesFirstYearStudent and SecondYearStudent and there is 1 more School class. So total 4 classes

In main function when School object is called 100 constructors from FirstYearStudent of Student and 100constructors from SecondYearStudent of Student and 1 of school constructor and 100 constructor of FirstYearStudent itself and 100 constructors of SecondYearStudent which means s a total of 401 objects will be created because 401 will be created.

Add a comment
Know the answer?
Add Answer to:
How to play Bulls and Cows between you (the host) and your computer (the player) When...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hangman is a game for two or more players. One player thinks of a word, phrase...

    Hangman is a game for two or more players. One player thinks of a word, phrase or sentence and the other tries to guess it by suggesting letters or numbers, within a certain number of guesses. You have to implement this game for Single Player, Where Computer (Your Program) will display a word with all characters hidden, which the player needed to be guessed. You have to maintain a dictionary of Words. One word will be selected by your program....

  • Overview In this exercise you are going to recreate the classic game of hangman. Your program...

    Overview In this exercise you are going to recreate the classic game of hangman. Your program will randomly pick from a pool of words for the user who will guess letters in order to figure out the word. The user will have a limited number of wrong guesses to complete the puzzle or lose the round. Though if the user answers before running out of wrong answers, they win. Requirements Rules The program will use 10 to 15 words as...

  • C++ Hangman (game) In this project, you are required to implement a program that can play...

    C++ Hangman (game) In this project, you are required to implement a program that can play the hangman game with the user. The hangman game is described in https://en.wikipedia.org/wiki/Hangman_(game) . Your program should support the following functionality: - Randomly select a word from a dictionary -- this dictionary should be stored in an ASCII text file (the format is up to you). The program then provides the information about the number of letters in this word for the user to...

  • For a C program hangman game: Create the function int play_game [play_game ( Game *g )]...

    For a C program hangman game: Create the function int play_game [play_game ( Game *g )] for a C program hangman game. (The existing code for other functions and the program is below, along with what the function needs to do) (Also the link to program files (hangman.h and library file) is below the existing code section. You can use that to check if the code works) What int play_game needs to do mostly involves calling other functions you've already...

  • Do in Python please provide screenshots aswell. Here are the requirements for your game: 1. The...

    Do in Python please provide screenshots aswell. Here are the requirements for your game: 1. The computer must select a word at random from the list of avail- able words that was provided in words.txt. The functions for loading the word list and selecting a random word have already been provided for you in ps3 hangman.py. 2. The game must be interactive; the flow of the game should go as follows: • At the start of the game, let the...

  • For this lab you will write a Java program that plays a simple Guess The Word...

    For this lab you will write a Java program that plays a simple Guess The Word game. The program will prompt the user to enter the name of a file containing a list of words. These words mustbe stored in an ArrayList, and the program will not know how many words are in the file before it starts putting them in the list. When all of the words have been read from the file, the program randomly chooses one word...

  • This is for C programming: You will be given files in the following format: n word1...

    This is for C programming: You will be given files in the following format: n word1 word2 word3 word4 The first line of the file will be a single integer value n. The integer n will denote the number of words contained within the file. Use this number to initialize an array. Each word will then appear on the next n lines. You can assume that no word is longer than 30 characters. The game will use these words as...

  • Use C++. In this project you will be tasked with writing a program to play a...

    Use C++. In this project you will be tasked with writing a program to play a guessing game between another player and your program. Your program will start by initializing an array to 5 fixed values in the ranges of 1-1000 in the array. These values should also be in order (sorted). Your program will then begin by asking the player to make a guess from 1-1000. For the first guess of the user, your program will only tell the...

  • PLEASE DO IN JAVA You can use any source for the dictionary or just a few...

    PLEASE DO IN JAVA You can use any source for the dictionary or just a few words are fine! description The purpose of this assignment is to practice with ArrayLists (and hopefully, you'll have some fun). As far as the user knows, play is exactly as it would be for a normal game of hangman, but behind the scenes, the computer cheats by delaying settling on a mystery word for as long as possible, which forces the user to use...

  • In Java You’re going to make a Guess the Number game. The computer will "think" of...

    In Java You’re going to make a Guess the Number game. The computer will "think" of a secret number from 1 to 20 and ask the user to guess it. After each guess, the computer will tell the user whether the number is too high or too low. The user wins if they can guess the number within six tries. The program should look like this in the console, player input is in bold: Hello! What is your name? Abaddon...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT