Question: void worldFindValue (const World world, int& result_row, int& result_column, NodeValue value_to_find); Add code to the function named worldFindValue. The function should takes a World, two



void worldFindValue (const World world, int& result_row, int& result_column, NodeValue value_to_find);
Add code to the function named worldFindValue. The function should takes a World, two references to ints and a NodeValue as parameters. The ints represent a row and a column, and the NodeValue is the value to search for. First, the function should set the row and column parameters to both be -1. Then it should search the World for a node with a value equal to the NodeValue parameter and, if it finds one, set the row and column parameters to that node's location. If there is more than one such value, you can use the location of any of them.
Note: At the end of this function, the row and column will have values of -1 if and only if the World does not contain search value.
C++ please. Write only the functions as the instructions. C++
void worldClear (World world); Add code to the function named worldClear, which takes a World as a parameter. It should set every element of the array to INACCESSIBLE. void worldDebugPrint (const World world); Add code to the function named worldDebugPrint that takes a World as a parameter. It should print out all the node values in the world in a grid and separated by tabs. Hint: Display the values in the array using two nested for-loops with cout statements inside. Print a newline (endl) after the last value in each line and a tab ("\t") after each other value. Warning: You must match this format exactly, including using tabs (not spaces) to separate values on the same line. Otherwise, the test program will think the output is incorrect and dock you marks. void worldLoadNodes (World world, string filename); Add code to the function named worldLoadNodes that takes a World and a string as parameters. The string represents the file name to load the nodes from. You should first open this data file for reading. Then load (i.e., read) the first ROW_COUNT COLUMN_COUNT integers from the file into the World array. If the file cannot be opened, print an error message. Hereafter, you should always print an error message when a file cannot be opened. Hint: Read in the world nodes using formatted 1/0 (>> notation). Optional: Close the input file when you are done. If you do not, it will automatically be closed when the ifstream variable goes out of scope, which is normally at the end of the function. void worldLoadAll (World world, string game_name); Add code to the function named worldLoadAll that takes a World and a string as parameters. The string represents the world name. Use the world name parameter to calculate the names of the node data and text data files (e.g. "blizzard" becomes "blizzard_grid.txt" and "blizzard_text.txt"). Use these filenames to call the worldLoadNodes and worldLoadDescriptions functions. Hint: You can use "+" to add two strings, i.e., "Fred " + "Flintstone" gives "Fred Flintstone". void worldLoadDescriptions (World world, string filename); Add a function named worldLoadDescriptions that takes a World and a string as parameters. The string represents the file name for the descriptions of the world nodes. Open the data file and load the descriptions into the global description array. Hint: If you are working in replit, you will need to create the file named blizzard_text.txt inside replit with no content. Then copy/paste the contents of the file from the website. It will not work to upload the file from the website on a Windows machine because of differences between Windows and Linux (replit runs on Linux). Hint: Read in the lines from the description file one at a time using getline. If the line you just read is not blank, add it to the end of the current description, followed by a newline. Otherwise, if you have not read enough descriptions yet, advance to the next description. Otherwise, you are done. Note: If you cannot make this function work, you can initialize the descriptions when you declare an array. If you do this, you will not get any marks for the worldLoadDescriptions function. void worldPrintStartMessage (const World world); void worldPrintEndMessage (const World world); Add a set of two functions named worldPrintStart Message and worldPrintEndMessage. Each of these functions should take a World as a parameter. These functions should print the descriptions with indexes START_MESSAGE and END_MESSAGE. Example: The END_MESSAGE constant has a value of 2, so the worldPrintEndMessage function would print: Thank you for playing Blizzard Valley! void worldPrintDescription (const World world, int row, int column); Add a function named worldPrintDescription that takes a World, a row, and a column as parameters. The function should determine the description number for that node and then print that description. When printing the descriptions, use an array lookup instead of many if statements. Example: Suppose you wanted to print the node with row 1 and column 2. (This is the second row and third column because the array is indexed from 0.) The description number for that node is 9, so the program would print: You are on a mountain slope, lost in the raging blizzard. Everything is white
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
