7 of 13 Stage 4 - Playing the game We are now at a stage where we can write the
ID: 3706192 • Letter: 7
Question
7 of 13 Stage 4 - Playing the game We are now at a stage where we can write the code that plays a game using the grid and associated words. The program should work like this: Welcome user to the program Ask the user which category of words they would like Generate a grid using words from this category Start a tmer (e.g. 3 minutes) In a loop . o Present the grid to the user o Allow the user to type in words they see in the grid o If they find all words in time -print congratulations message o If the timer reaches zero print game over message o (Optional) Clear screen after every user guess Exit You are free to embellish your program however you like, but you must ensure that it can perform at least the tasks above. If in doubt refer to the specification. An example output of the game can be seen in the appendix Stage 5-Overlapping wordsExplanation / Answer
I've created a fairly simple word search generator/solver. I'm looking to improve on picking the right algorithm to tackle problems like this
It's nicer to have a space between the #include and the header:
Be aware that with <windows.h> and system("cls"), this program is non-portable to other operating systems. If you don't want it this way, then you should consider having alternatives that work with other operating systems.
You have a lot of global variables, which should be avoided as much as possible. If a variable does need to be visible in this scope, then make them const, preventing such variables from being modified elsewhere.
For everything else, try to keep them in the lowest scope possible by passing them to other functions as needed.
For example, the arrays under the comment /*data to choose the words from*/ could all be const since it appears that they are only to be read.
Try to avoid having lengthy comments in a single line. Forcing the reader to scroll across the screen to read comments can be pretty annoying. Instead, place them in blocks above the individual line of code.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.