Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Start a new C program. Create a main ( ) that calls a function called initialization ( ) , then gameLoop ( ) , then
Start a new C program.
Create a main that calls a function called initialization then gameLoop then teardown Should return
Initialization will call a function getPuzzle which will return a string for a new puzzle. You can make getPuzzle return a constant string of your choice any sentence. Initialization will set a global variable to the string.
gameLoop will loop over the following functions:
acceptInput will print a prompt:
Enter a letter and then the letter to replace it with or 'quit' to quit.
Then accept a line from the user use fgets Return the string.
updateState will take the line from acceptInput It will return true if the string is quit OR is NULL and false otherwise.
displayWorld will print the global puzzle variable as a string.
gameLoop will stop looping when updateState returns true it is OK to call displayWorld one more time
tearDown will print All DoneStart a new C program.
Create a main that calls a function called initialization then gameLoop then teardown Should return
Initialization will call a function getPuzzle which will return a string for a new puzzle. You can make getPuzzle return a constant string of your choice any sentence. Initialization will set a global variable to the string.
gameLoop will loop over the following functions:
acceptInput will print a prompt:
Enter a letter and then the letter to replace it with or 'quit' to quit.
Then accept a line from the user use fgets Return the string.
updateState will take the line from acceptInput It will return true if the string is quit OR is NULL and false otherwise.
displayWorld will print the global puzzle variable as a string.
gameLoop will stop looping when updateState returns true it is OK to call displayWorld one more time
tearDown will print All Done
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