Question: Write code in C please! Read carefully! Create a #define called MAPSIZE. Set to 10. Create global variable MapFilename. Use char array and set them
Create a #define called MAPSIZE. Set to 10. Create global variable MapFilename. Use char array and set them to nulls by using 0). Make it at least 20. Create a structure called PlayerInfo that has a char array called PlayerName of size 20 and two int members called CurrentRow and Curentol to hold the current position of the player. Function HoveNorth should have a return value of int and two parameters-the Map array and a pointer to Player. If moving the Players current position north results in a spot on the map that is part of the path (Hap element is set to x, s or E), then decrement the Player's row and return true to show that a move was made; otherwise, print message "North is the wong move" and return false to show that a move was not made. Function HoveSouth should have a return value of int and two parameters-the Map array and a pointer to Player If moving the Player's current position south results in a spot on the map that is part of the path (Map element is set to X, S or E), then increment the Player's row and return true to show that a move was made; erwise, print message "South is the wrong move" and return false to show that a move was not made. Function Move East should have a return value of ? nt and two parameters-the Map array and a pointer to Player. If moving the Player's current position east results in a spot on the map that is part of the path (Map element is set to X, S or E), then increment the Player's colum and return true to show that a move was made; otherwise, print message East is the wrong move" and return false to show that a move was not made. Function Movelest should have a return value of int and two parameters-the Map array and a pointer to Player. If moving the Player's current position west results in a spot on the map that is part of the path (Map element is set to X, Sor E), then decrement the Player's column and return true to show that a move was made; otherwise, print message "West is the wrong move" and return false to show that a move was not made. Function get_command 1ine params should have a return value of void and parameters of argc andargv Create a for loop with argc to go through each value of argv Look for an argv of MAP- When found, take the string after the- as the value to store in MapFilename After looking at all of the strings in argv, if you do not have a value for MapFilename, then print the message MAP must be given on the command line and exit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
