Answered step by step
Verified Expert Solution
Question
1 Approved Answer
- The program source file should be called WordSearch.c - The ROWS and COLUMNS of the board should be properly hard-coded at the top of
- The program source file should be called WordSearch.c - The ROWS and COLUMNS of the board should be properly hard-coded at the top of your program (use \#define) to both be 20. - The board in which to place the words should be a 2D array that is ROWS COLUMNS in size and it should initially have no letters in it (e.g., space characters). - The words that you will insert MUST be these exact 15 words, which should be hard-coded into an array like this (you must define the two constants): char words [NUM_WORDS] [MAX_WORD_SIZE] = - You must place each word in the order given, into the 2020 board. To do so, you should choose a random row (0 to 19) and column (0 to 19) in the board and start with the horizontal/right direction. Your code should check to see if the word will fit into the board at the chosen row/column in the given direction. Note that only the non-space characters need to fit. So "MINTCHIP" must fit 8 characters while "LEMON" needs to only fit 5 characters. A word will "fit" if each of its letters get placed onto either an empty location, or a location where the letter matches. For example, you can fit "LEMON" and "NEOPOLITAN" on the same line with the shared N as follows: LEMONEOPOLITAN. Keep in mind that the word must not go outside of the board's range. If the word does not fit at that row/column, then a new row/column should be chosen randomly again and the word should be tried at that new position. This process should be repeated until the word finally is able to fit. Once it is known that the word will fit at the chosen row/column and direction, then you should insert the word there. - You MUST make a function that takes the board as a parameter and prints out the board's characters (see output below). - Your program should print out the board at this time. Make sure that your code places all words horizontally at some valid location and that if there are overlapping words, then they share the same letters at that overlap. - Now adjust the code to work for the horizontal left direction ... so that words are shown as written backwards. Make this as a separate case from horizontal write... but don't discard your old code, you will need it again. Test to make sure that it still words and places all words backwards with no problems. - Keep your horizontal direction code (perhaps comment it out for now) and change your code to work for vertical up and vertical down directions. Once it works in all 4 directions, adjust your code so that when a random row/column is chosen, then one of these 4 directions is also chosen and you are to try it in that random direction. If it does not fit in that direction, then rechoose the row/column/direction again and try again until all words fit. - Add code to allow the words to be placed diagonal up left, diagonal down left, diagonal up right, diagonal down left ... so that you now have 8 random directions to choose from. - Your program should then add "filler characters" to all blank spaces after the words have been inserted. The filler characters must all be lowercase characters, chosen randomly from the English alphabet. Then it should print the board again. - Then your program should convert the filler characters all to their uppercase equivalents (in an efficient manner) and then display the board again ... so that the placed words become hard to find. - Make sure to draw a kind of line between the boards to distinguish them. The table below shows sample output for three runs... although the board will always be different due to the randomness each time you run
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