The Atlantic Coastal Mariners (ACM) sailing club is building a race planning tool to estimate durations of sailboat races with various race courses, wind directions, and types of sailboats. You must write a program to help with that task. A race course is defined by marks with up to 10 marks per race course. A sailboat must sail to all marks in the specified order. The marks are identified as x- and y-coordinates on a hypothetical grid with a single unit equal to one nautical mile (nm). The positive y-axis is oriented due north and the positive x-axis is oriented due east. The race course is in open waters without any navigational limitations. For purposes of this planning tool, the only driving force controlling a sailboat is the wind. The wind determines the sailboat’s speed of advance and limits its direction of travel. The wind is constant for the duration of each race and is specified in terms of the direction from which the wind is blowing and its speed in nautical miles per hour (kts). Wind direction is specified as a compass bearing in degrees measured clockwise from 000.0o as north. Sailboats cannot steer any closer to the wind than a given “point angle” off the wind direction. In order to make progress closer to the wind direction, the sailboat must tack back and forth across the wind, steering no closer to the wind than its point angle. Each time the sailboat tacks or passes a mark it incurs a tack penalty. For this simulation, each sailboat will travel each leg of a race (the portion of a race between successive marks) with the minimum number of tacks and the minimum possible distance. Courses and directions are specified as compass bearings in degrees measured clockwise from 000.0o as north. The speed of a sailboat is determined by the sailboat design, wind speed, and direction steered relative to the wind. In the figure, the wind direction is 45o and the point angle is 40o. This means then that this sailboat cannot steer between 5o and 85o because it cannot point that closely into the wind. For this problem, the ratio of sailboat speed to wind speed is in the table below according to the angle off the wind : Angle off wind ≥ point angle and < reach angle ≥ reach angle and < downwind angle ≥ downwind angle one of three ratios, selected as shown Applicable ratio point speed ratio reach speed ratio downwind speed ratio For instance, if the boat is steering at an angle off the wind which is between the reach angle and downwind angle then boat speed = reach speed ratio × wind speed
2/3 Input Point angle is 40o Reach angle is 60o Downwind angle is 145o Sailboat cannot travel from P in this di- rection Sailboat traveling from P in this direction moves at point speed ratio times wind speed Sailboat traveling from P in this direction moves at reach speed ratio times wind speed Sailboat traveling from P in this direc- tion moves at downwind speed ratio times wind. Each angle is measured as the smallest angle between the direction of travel of the sailboat and the direction from which the wind is blowing. Your solution must accept multiple input data sets. Each data set represents a different race course to be evaluated for a single sailboat. The data set begins with a line with 4 numbers: wind direction (real), wind speed (real), tack penalty (real), and number of marks n (integer). The next line contains six real numbers: point angle, point speed ratio, reach angle, reach speed ratio, downwind angle, downwind speed ratio. The subsequent n lines of the data set represent the n race marks in the order in which they must be reached. Each line begins with a 2-character mark id followed by the x-coordinate then y-coordinate of the mark. The end of input is denoted by a line of four 0’s. Output The output for your program consists of various data calculated for each input data set. Values should be presented with the following precisions and units. Courses, tacks, directions 0.1 degree Distance 0.01 nm Speed 0.1 kts Time 0.01 hours Output for each race begins with a header containing the number of the data set (1 for the first, 2 for the second, etc.) and the number of legs. The next line is the total length of the race course, measured as the sum of distances between successive marks. For each leg of the course, the leg number, beginning and ending mark id’s, course from the beginning to end marks of the leg, and the leg distance is presented. This is followed by a listing of the tacks necessary to complete the leg. The tacks for each race are numbered sequentially, with tack numbers beginning with 1 for each race. For each tack, the tack number, the projected sailboat speed, the course steered, and the length of that tack are presented.