Answered step by step
Verified Expert Solution
Link Copied!

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

Explain the strength of acid and alkali solutions with examples

Answered: 1 week ago

Question

Introduce and define metals and nonmetals and explain with examples

Answered: 1 week ago