You are so recognized now as a premiere programmer that you were hired by pirates to guide their ship out of harbor and onto the open sea. You will have to avoid numerous perils along the way.
The area between the harbor and the hole in the reef can be represented by a 15-by-30 grid where each point representing a square nautical mile. Contained in this grid are:
One British battleship on patrol.
Very hungry great white sharks that fancy pirates (they taste like chicken marinated in Guinness).
Random icebergs. In addition, the entire perimeter of the oceanic area described is made up of icebergs that formed overnight.
A single exit point from the wall of surrounding icebergs that will release your ship into the open sea for escape.
Your program will repeatedly ask you which direction you want to move in. Each time you move, you must try to avoid hitting, or being hit/eaten by an iceberg or a shark (remember, they’re very big and like to eat pirates), or being blasted by the Brits. You are within range of the Brits if you are in an adjacent square to their war vessel, including diagonal squares. It’s almost certain that your ship will be obliterated by cannon fire.
You are being provided with the functions that you will need below. You simply need to add these to your program and complete the code and commit your program as below (see submission). The function prototypes and purposes are as follows:
Give the user playing instructions.
void readMap(char ocean[ROWS][COLUMNS], int, int, int, int);
Read in the initial map from a file (this is the [url removed, login to view] file). Parameters include the map, your current position and the coordinates of the hole in the wall. The file contains exactly 15 lines of 30 integers per line, coded as follows:
0 = open sea
1 = iceberg
2 = shark
3 = British battleship
4 = the escape position
5 = your pirate ship
When you create the actual map you are to insert/convert to the actual characters to be displayed into the array.
Your ship and mates are represented by the character ‘’. (Arrgh!)
The battle ship is represented by an asterisk ‘*’.
Sharks are represented by the Latin symbol ‘œ’ (which sort of looks like a fish with its mouth open).
Icebergs are represented by a solid dot ‘’.
Open sea is represented by a blank ‘ ’.
The escape position is represented by an ‘X’.
You read in the map as a 2-dimensional array of integers for the sole purpose of file reading sanity. However, this is not how it will appear when you display it on the screen. You may not use the integer array to represent your ocean. As you read numbers, populate a 2-dimensional character array appropriately and proceed when finished reading the file.
16 freelancers are bidding on average $172 for this job
HI Contact me for an efficient, perfect, well documented development of your project according to 100% accuracy and requirements, with dedicated support. Thanks Farah Saif