Question: 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 0.
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.Start a new C program.
Create a main() that calls a function called initialization(), then gameLoop(), then teardown(). Should return 0.
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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!