The data must be readable when opened in a standard text editor. An example results file is illustrated as follows, though exactly how your file is organized is up to you. Bulls & Cows game result. Your code: 4568 Computer's code: 4281 Turn 11 You guessed 1234, scoring 1 bull and 2 cows Computer guessed 5940, scoring bulls and 2 cows www Turn 21 You guessed 1345, scoring e bulls and 2 cows Computer guessed 1279, scoring @ bulls and cows Turn 31 You guessed 4271, scoring 3 bulls and cows Computer guessed 4890, scoring 1 bull and 1 cow Turn 4: You guessed 4281, scoring 4 bulls and cows You win! :) NW Task Eight: Advanced Configuration Save your Task 7 code on a different package. Modify your code so that two of the following values are configurable for Easy Al: *The maximum allowed number of turns before the game ends in a draw (default is seven) The length of a secret code (default is four) *The allowed characters in a secret code (default are the digits 0-9, but letters should be able to be included also. For example, you could say that the allowed characters for a particular game are the digits 0-9, and the letters A-F). To configure these values, you may either read them in from a file or simply have constant variables somewhere obvious in your code, which the user can edit and then re-compile. Note: It is important that, when configuring these values, the rest of your code should not break! Everything else should continue working as normal.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter14: Files And Streams
Section: Chapter Questions
Problem 2E: Create a program named FileComparison that compares two files. First, use a text editor such as...
icon
Related questions
Question
The data must be readable when opened in a standard text editor. An example results file is
illustrated as follows, though exactly how your file is organized is up to you.
Bulls & Cows game result.
Your code: 4568
Computer's code: 4281
Turn 1:
You guessed 1234, scoring 1 bull and 2 cows
Computer guessed 5940, scoring bulls and 2 cows
Turn 21
You guessed 1345, scoring e bulls and 2 cows
Computer guessed 1279, scoring bulls and cows
Turn 3:
You guessed 4271, scoring 3 bulls and cows
Computer guessed 4890, scoring 1 bull and 1 cow
Turn 4:
You guessed 4281, scoring 4 bulls and cows
You win! :)
MN Task Eight: Advanced Configuration
Save your Task 7 code on a different package.
Modify your code so that two of the following values are configurable for Easy Al:
*The maximum allowed number of turns before the game ends in a draw (default is seven)
The length of a secret code (default is four)
*The allowed characters in a secret code (default are the digits 0-9, but letters should be able
to be included also. For example, you could say that the allowed characters for a particular
game are the digits 0-9, and the letters A-F).
To configure these values, you may either read them in from a file or simply have constant
variables somewhere obvious in your code, which the user can edit and then re-compile.
Note: It is important that, when configuring these values, the rest of your code should not
break! Everything else should continue working as normal.
Transcribed Image Text:The data must be readable when opened in a standard text editor. An example results file is illustrated as follows, though exactly how your file is organized is up to you. Bulls & Cows game result. Your code: 4568 Computer's code: 4281 Turn 1: You guessed 1234, scoring 1 bull and 2 cows Computer guessed 5940, scoring bulls and 2 cows Turn 21 You guessed 1345, scoring e bulls and 2 cows Computer guessed 1279, scoring bulls and cows Turn 3: You guessed 4271, scoring 3 bulls and cows Computer guessed 4890, scoring 1 bull and 1 cow Turn 4: You guessed 4281, scoring 4 bulls and cows You win! :) MN Task Eight: Advanced Configuration Save your Task 7 code on a different package. Modify your code so that two of the following values are configurable for Easy Al: *The maximum allowed number of turns before the game ends in a draw (default is seven) The length of a secret code (default is four) *The allowed characters in a secret code (default are the digits 0-9, but letters should be able to be included also. For example, you could say that the allowed characters for a particular game are the digits 0-9, and the letters A-F). To configure these values, you may either read them in from a file or simply have constant variables somewhere obvious in your code, which the user can edit and then re-compile. Note: It is important that, when configuring these values, the rest of your code should not break! Everything else should continue working as normal.
Modify your code so that before the game begins, the player is asked whether they wish to
enter their guesses manually, or to automatically guess based on pre-supplied guesses in a file.
If the first option is chosen, then the game should progress in the same fashion as in the tasks
above. If the second option is chosen, then the following actions should be taken:
Firstly, the player should be asked to enter a filename. If the player enters an invalid filename,
they should be re-prompted until they enter the name of a file that actually exists. This file
should then be read and interpreted as a text file, where each line contains a separate guess.
For example, a sample file input.txt may contain the following text:
1234
4321
5830
8437
1489
3271
2530
You may assume that each line of the file contains a valid guess.
Once the file has been read, then the game should proceed as normal. However, when the
player would be prompted to enter a guess, the next guess in the list of pre-supplied guesses
should automatically be chosen instead. If there are no more pre-supplied guesses (for
example, if the player needs to enter their fifth guess but the file only contains four guesses),
then the player should be prompted as normal.
#Task Seven: Saving to a File,
Save your Task 6 code on a different package.
Modify your code so that, when the game ends (win, lose, or draw), the player is asked if they
wish to save the results to a text file. If they do, then they'll be prompted to enter a filename.
The game should then save the following information to the given file:
*The player and computer's secret number
* Each guess that was made, in the same order as occurred during the game, along with the
result of that guess (i.e. how many bulls & cows it got)
*The identity of the winner (or a message stating that the game was a draw)
Transcribed Image Text:Modify your code so that before the game begins, the player is asked whether they wish to enter their guesses manually, or to automatically guess based on pre-supplied guesses in a file. If the first option is chosen, then the game should progress in the same fashion as in the tasks above. If the second option is chosen, then the following actions should be taken: Firstly, the player should be asked to enter a filename. If the player enters an invalid filename, they should be re-prompted until they enter the name of a file that actually exists. This file should then be read and interpreted as a text file, where each line contains a separate guess. For example, a sample file input.txt may contain the following text: 1234 4321 5830 8437 1489 3271 2530 You may assume that each line of the file contains a valid guess. Once the file has been read, then the game should proceed as normal. However, when the player would be prompted to enter a guess, the next guess in the list of pre-supplied guesses should automatically be chosen instead. If there are no more pre-supplied guesses (for example, if the player needs to enter their fifth guess but the file only contains four guesses), then the player should be prompted as normal. #Task Seven: Saving to a File, Save your Task 6 code on a different package. Modify your code so that, when the game ends (win, lose, or draw), the player is asked if they wish to save the results to a text file. If they do, then they'll be prompted to enter a filename. The game should then save the following information to the given file: *The player and computer's secret number * Each guess that was made, in the same order as occurred during the game, along with the result of that guess (i.e. how many bulls & cows it got) *The identity of the winner (or a message stating that the game was a draw)
Expert Solution
steps

Step by step

Solved in 4 steps with 7 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning