Question
Create a PERL script for a number guessing game. Here are the requirements: a. Your program generates a random number between 100 and 200 and
Create a PERL script for a number guessing game. Here are the requirements: a. Your program generates a random number between 100 and 200 and keeps asking the user to guess the number until the user guesses it correctly. If the user guesses a number that is lower or higher than the number to be guessed then indicate that information to the user as a low guess or a high guess so that the user can get to the correct guess quicker. b. The program keeps track on number of guesses taken by the user to get to the correct guess. This is users score. c. Use a parameter for number of allowed guesses (set it some value, say 7) and your program congratulates users if user guesses the number correctly in number of guesses less than the number of allowed guesses. The program doesnt allow user to continue beyond the number of allowed guesses and tells user that the number wasnt guessed correctly in allowed attempts. You can print the number of allowed guesses at the beginning of the game. d. Write out user name and number of guesses taken to a game report file. Each attempt at the game will add a new line to the report file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started