203 - Running Lights Visibility Calculator

All about problems in Volume 2. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

User avatar
GreenPenInc
Learning poster
Posts: 53
Joined: Sat May 01, 2004 9:31 pm
Contact:

203 (Running Lights Visibility) -- can't get my bearings!

Post by GreenPenInc » Sun Aug 22, 2004 3:01 pm

I tried to code up the calculation of the bearings, and I'm getting some weird answers compared to the provided output. Problem is, I think my output is right and the supplied output is wrong!

Consider: If I'm at 0,0 facing 90 degrees, and there's a ship at 10,10 then the bearing should be 315 degrees, yes? But the problem says 90. Why is that?

Well I have to go but hopefully I've described the problem well enough.
_-(GPI)-_

"Finally I have freed myself from the clutches of the garbage fairy!"

Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden

Post by Per » Sun Aug 22, 2004 7:12 pm

A quote from the problem statement (emphasis mine):
the program will first calculate the relative bearings from other ships to your ship
Not the other way around.

User avatar
GreenPenInc
Learning poster
Posts: 53
Joined: Sat May 01, 2004 9:31 pm
Contact:

Post by GreenPenInc » Wed Aug 25, 2004 3:01 pm

Boy, sure helps to read that problem description eh? That really changed things for the better. Now, I've coded it all up and it does the test data perfectly. For all floating point operations I use an epsilon value of 10^(-7), just as it says. But I still got WA.

Here are some of the relevant functions I've used. Could any of these be the problem?

[cpp]
#define EPSILON 0.0000001
#define PI 3.1415926536

/* double comparison with compensation for rounding errors */
int compare(double a, double b)
{
if (fabs(a - b) < EPSILON)
return 0;
if (a < b)
return -1;
return 1;
}

/* Given degrees, returns radians */
double radians(double degrees)
{
return degrees / 180.0 * PI;
}

/* Given radians, returns # of degrees 0 <= d < 360 */
double degrees(double radians)
{
double d = radians / PI * 180.0;
while (compare(d, EPSILON) < 0)
d += 360.0;
while (compare(d, 360.0) >= 0)
d -= 360.0;
if (compare(d, 359.995) >= 0 || compare(d, EPSILON) <= 0)
return EPSILON / 10;
return d;
}

/* True if the two angles (in degrees) fall within max_diff degrees of each other */
bool degree_compare(double a1, double a2, double max_diff)
{
double d = fabs(a1 - a2);
if (compare(d, max_diff) <= 0)
return true;
if (compare(a1, a2) < 0)
a1 += 360.0;
else
a2 += 360.0;
d = fabs(a1 - a2);
bool bReturn = compare(d, max_diff) <= 0;
return bReturn;
}

/* Finds the actual distance between two points given their x- and y-distances */
double dist(double delta_x, double delta_y)
{
return sqrt(delta_x * delta_x + delta_y * delta_y);
}

[/cpp]
_-(GPI)-_

"Finally I have freed myself from the clutches of the garbage fairy!"

Moha
Experienced poster
Posts: 216
Joined: Tue Aug 31, 2004 1:02 am
Location: Tehran
Contact:

Post by Moha » Wed Sep 29, 2004 6:54 am

can anybody explain this statement:
display the expected configurations of visible lights from left to right as viewed from your own ship

Moha
Experienced poster
Posts: 216
Joined: Tue Aug 31, 2004 1:02 am
Location: Tehran
Contact:

Post by Moha » Wed Sep 29, 2004 4:45 pm

I think if we assume ships as segment then in segment we have 4 light that if we see ship from up (0 course) or down (180 couse) then lights are collinear and we should sort them.
otherwise if we see ship from left of right we can sort light from left to right.
this is the main point of this problem, I think. but I got WA if some body have got any I/O please write it.

thanks.

sclo
Guru
Posts: 519
Joined: Mon Jan 23, 2006 10:45 pm
Location: Vancouver, BC, Canada
Contact:

Post by sclo » Thu Mar 16, 2006 3:52 am

The judge is still pretty sensitive to floating point errors, I have to use long double to compute the bearing. But if I used long double for all calculations then I get WA. I only get AC if I only use long double to compute the bearing.

sjn
Learning poster
Posts: 73
Joined: Mon Apr 08, 2002 8:22 am
Contact:

more I/O?

Post by sjn » Mon Apr 02, 2007 3:45 pm

anybody can provide more I/O?
thx in advance

sjn
Learning poster
Posts: 73
Joined: Mon Apr 08, 2002 8:22 am
Contact:

Post by sjn » Mon Apr 02, 2007 4:51 pm

what's for ?

Code: Select all

Sample Test Data Set 3
3
Ownship
0.0 0.0 90.0 10.0
Ship001
1.0 0.0 90.0 10.0
Ship002
-1.0 -0.0 90.0 10.1
Ship003
0.0 1.0 135.0 14.14

stubbscroll
Experienced poster
Posts: 151
Joined: Tue Nov 16, 2004 7:23 pm
Location: Norway
Contact:

Post by stubbscroll » Mon Apr 09, 2007 12:06 am

I get the following output for the set above:

Code: Select all

RerjFKtJfZFdIlCkUHdZURQUQuYKehbmhOQXvmWi
1
Ownship
21.8 17.0 113.0 82.3
QpFKCqEMBUZo
23.5 17.5 48.1 91.9
Here's some input I have lying around, which I used to solve the problem. Some of these cases are random-generated, and might be less useful (for instance, too many "Light not visible".)

Code: Select all

pQHMAlldFRVcGBkNDXfFzsTjRPgrnVsMCSYqeIeF
29
Ownship
38.4 72.8 296.2 13.5
WRnKcftSysaP
76.0 6.9 296.5 43.2
eupaOgOyfbpj
55.4 68.4 228.6 42.1
eWNRPXjLoAWX
2.3 43.8 109.2 22.3
OsZVtDnyyFxS
46.2 16.1 160.0 33.5
xrBNGOKtyNOU
69.6 11.1 260.1 9.9
TIJAypSmSjfG
11.7 81.4 271.2 98.9
ynRDPsTswDZo
48.4 87.2 83.7 86.7
jvwxRbdGLgUB
46.9 43.5 104.7 31.9
SpoGgKudoOBx
34.5 49.7 87.0 29.6
UeZHlUGEjqJn
6.4 32.1 52.4 25.4
JrzaulchFMIw
88.1 65.0 113.4 54.4
UnSssTKqCzEu
31.7 60.6 16.7 55.2
JpINedsraYma
15.6 39.6 87.7 2.1
unpSABZXHchE
89.2 66.0 93.6 14.3
pWqgoaMwDYXt
76.8 87.8 148.9 66.3
crbpOhKQuRzn
21.4 20.2 84.8 9.1
lzpIgLeduORR
91.1 28.1 148.4 15.6
wPWJLfAmIpPu
28.2 24.9 170.9 78.6
MaXNnhQrulfo
82.4 26.7 39.7 74.2
LDmcOkFjRXtO
23.2 92.8 280.1 93.4
lfIPyczIkaxg
69.9 43.8 293.2 70.0
GXtvRhBpibvB
1.6 43.0 58.8 28.6
oZKBjmsTsfOF
0.8 63.3 206.5 37.4
ZuZWIuPXqlUV
87.5 1.4 230.0 60.2
NfjAMcFKiuuI
30.4 62.8 112.5 58.0
KbckZzODKhZF
47.2 85.3 216.3 34.7
PZkoUdtxJker
23.4 26.4 65.5 25.5
OWtpPciKlyiR
81.5 91.7 132.8 68.8
nVZDyNYdumHE
81.4 8.4 249.5 21.4
ogFZvqXWmxYGDAZGVokgCmmRHyYGJKkzAXKOZMuZ
67
Ownship
45.6 39.6 231.4 23.2
diCyuFBSEygv
25.7 99.4 271.9 32.1
FRrskTDHRIbz
83.2 62.4 240.1 40.9
paAWEJchrvjS
90.9 72.5 15.2 32.7
npYgIOqWwZQe
52.9 21.8 230.0 49.2
vIPLyMmukHED
36.3 82.3 296.6 95.3
GpFDJJWqUqIv
54.0 15.6 190.1 75.5
guLjusabLmqM
13.0 73.7 132.1 87.7
QTdEmcbrtEYw
43.1 69.3 139.5 17.4
MAawvsBOoLHp
19.4 31.3 283.4 96.5
KFgyHCySEZTo
47.6 98.9 310.3 67.5
hiRQjWJmpHeq
78.0 5.7 73.6 7.2
JcyfviUEgidC
54.6 78.1 91.1 52.4
AunGpOyoCqkM
56.6 29.6 289.9 77.4
HdmhQAHRtfAl
68.1 79.6 323.7 70.4
clEJMnRyZirn
60.2 5.5 60.4 57.6
RuxrUEjBxyfK
9.8 89.8 195.2 78.3
dxDvCuDCXAds
28.0 60.5 92.2 86.9
gvJoOLkgFPPK
78.0 63.9 139.3 61.8
xZqlVbwXiFfC
11.0 68.2 297.3 74.9
WBqCHBJlMQgM
65.5 70.0 211.8 7.9
lGfPusucyvHP
2.2 95.8 181.3 66.4
xfPpfLpPefmK
99.5 70.4 163.3 8.0
muMtpnmDySvP
99.1 82.5 137.8 36.7
FUHEKkSmNNaX
13.7 44.3 150.5 72.5
QPFVUSFWhxZj
30.5 95.6 206.9 59.3
XtGKtILdiQDJ
53.5 18.1 183.1 86.8
JBcJRnDcddRp
75.6 3.0 62.1 55.8
UtWlRlzzbuXo
88.0 65.5 57.7 25.5
aNOJiVoqNKvH
4.9 43.1 252.2 30.2
GJSxaMuqHkhX
62.5 25.5 144.1 74.9
qsFEdUJoxOkv
74.3 7.1 79.7 4.2
wfUxfPSyLjHv
10.7 41.5 239.0 67.8
FOgGNaDLHGyj
35.8 15.9 104.5 28.1
zosKugNnaJpi
83.1 52.7 56.0 44.2
NOxjmskHwoML
27.9 78.2 62.6 0.3
LqWmvhmOpByw
43.6 78.9 158.4 42.6
XpaknTuazODW
38.4 91.6 106.0 88.8
QDstXAYqXcXw
84.3 82.7 176.5 66.9
cDOaXPmBlsxK
0.3 70.6 305.1 56.9
dykcbTvXxJot
73.8 37.6 111.9 91.5
kcATUgDpwYAa
17.5 30.2 229.6 84.5
ysTZvdySXBfv
34.7 46.8 203.0 66.9
PHzaMNNimuCt
53.3 85.0 23.4 63.6
pHWJzKCmPxxZ
29.3 66.4 256.3 9.8
iYXqerieXfsD
88.4 9.4 161.7 10.2
wJFBLZBnatHd
73.6 69.1 134.1 22.6
KNuhkETwasnq
97.2 40.8 279.8 74.8
fFgPVrjZlmjN
89.3 18.1 103.6 86.9
BAcFCZBhUxav
90.1 12.2 22.4 78.9
SCMVDwmNWUDC
33.9 63.0 238.4 34.7
ULmCwWkLbQVS
95.1 97.1 104.7 32.1
ggazSuZfHXJJ
23.4 0.7 97.0 58.9
NmjvuNcyewoH
39.5 69.9 144.3 8.8
VZIZuwfLtqXY
79.4 52.7 351.3 4.2
KEbLYraNxUmI
86.4 9.0 163.6 42.7
AowxtXUzWUPB
18.0 56.6 124.5 80.2
knBcBjDjiilp
80.6 12.1 213.9 25.7
dQvtEhLlbVQZ
2.3 15.6 184.6 32.6
QyhxDIFewIEq
80.5 64.7 317.5 1.8
mJfGMGtJnqmp
6.7 68.2 253.3 22.9
iSPqjDywYTLY
95.0 10.8 314.4 17.4
BvrLvekIayjE
94.4 94.2 293.7 26.3
APhbibNwrLRz
28.8 95.2 78.3 40.6
AfEIzyAUmhKn
4.7 90.6 11.4 40.4
ZNtsWhFjRBHq
3.5 85.2 169.1 21.7
vEYpfpHuaTWt
95.0 60.6 264.0 15.6
iyrXxzeBekQI
64.8 43.1 212.4 41.5
Ruben's Boat Data Set 1
7
Ownship
0.0 0.0 0.0 1.0
Degree-ship
0.003 -90.0 0 1.0
Another ship
0.003 -5.0 0 0.3
Ship
0 -5.0 0 1.9
Shippique
0 -5.0 180 1.9
Sheep
10.0 0.0 55.7 1.0
Bowling-skibet
1.005 0.0 111.1 2.2
Katamari
1.015 0.0 222.2 2.3
RerjFKtJfZFdIlCkUHdZURQUQuYKehbmhOQXvmWi
1
Ownship
21.8 17.0 113.0 82.3
QpFKCqEMBUZo
23.5 17.5 48.1 91.9
Output for the above input:

Code: Select all

Scenario: pQHMAlldFRVcGBkNDXfFzsTjRPgrnVsMCSYqeIeF

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
WRnKcftSysaP      33.79       75.87     Lights not visible
eupaOgOyfbpj      55.91       17.56     Lights not visible
eWNRPXjLoAWX     302.02       46.31     Lights not visible
OsZVtDnyyFxS     192.17       57.23     Lights not visible
xrBNGOKtyNOU      73.08       69.14     Lights not visible
TIJAypSmSjfG     196.65       28.05     Lights not visible
ynRDPsTswDZo     131.08       17.53     Lights not visible
jvwxRbdGLgUB     239.12       30.51     Lights not visible
SpoGgKudoOBx     282.58       23.43     Lights not visible
UeZHlUGEjqJn     345.78       51.77     Lights not visible
JrzaulchFMIw     165.52       50.31     Lights not visible
UnSssTKqCzEu      12.07       13.92     Lights not visible
JpINedsraYma     306.78       40.28     Lights not visible
unpSABZXHchE     184.02       51.25     Lights not visible
pWqgoaMwDYXt      99.76       41.23     Lights not visible
crbpOhKQuRzn     293.11       55.28     Lights not visible
lzpIgLeduORR     161.90       69.10     Lights not visible
wPWJLfAmIpPu     201.12       48.97     Lights not visible
MaXNnhQrulfo     276.64       63.73     Lights not visible
LDmcOkFjRXtO     222.67       25.12     Lights not visible
lfIPyczIkaxg      19.43       42.82     Lights not visible
GXtvRhBpibvB     352.20       47.35     Lights not visible
oZKBjmsTsfOF     229.32       38.78     Lights not visible
ZuZWIuPXqlUV      95.48       86.65     Lights not visible
NfjAMcFKiuuI     286.16       12.81     Lights not visible
KbckZzODKhZF     358.85       15.29     Lights not visible
PZkoUdtxJker     312.41       48.76     Lights not visible
OWtpPciKlyiR     113.52       47.06     Lights not visible
nVZDyNYdumHE      76.77       77.44     Lights not visible
***************************************************************
Scenario: ogFZvqXWmxYGDAZGVokgCmmRHyYGJKkzAXKOZMuZ

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
diCyuFBSEygv     249.69       63.02     Lights not visible
FRrskTDHRIbz     358.67       43.97     Lights not visible
paAWEJchrvjS     218.81       55.99     Lights not visible
npYgIOqWwZQe     107.70       19.24     Lights not visible
vIPLyMmukHED     231.11       43.70     Lights not visible
GpFDJJWqUqIv     150.61       25.43     Lights not visible
guLjusabLmqM       4.19       47.18     Lights not visible
QTdEmcbrtEYw      35.69       29.81     Lights not visible
MAawvsBOoLHp     149.02       27.48     Lights not visible
KFgyHCySEZTo     231.63       59.33     Lights not visible
hiRQjWJmpHeq     242.70       46.89     Lights not visible
JcyfviUEgidC     102.06       39.54     Lights not visible
AunGpOyoCqkM      22.37       14.87     Lights not visible
HdmhQAHRtfAl     245.66       45.89     Lights not visible
clEJMnRyZirn     276.42       37.09     Lights not visible
RuxrUEjBxyfK     309.31       61.66     Lights not visible
dxDvCuDCXAds      47.70       27.32     Lights not visible
gvJoOLkgFPPK      93.83       40.50     Lights not visible
xZqlVbwXiFfC     192.28       44.89     Lights not visible
WBqCHBJlMQgM       1.41       36.33     Lights not visible
lGfPusucyvHP     321.02       71.01     Lights not visible
xfPpfLpPefmK      76.96       62.08     Lights not visible
muMtpnmDySvP      93.47       68.58     Lights not visible
FUHEKkSmNNaX     307.88       32.24     Lights not visible
QPFVUSFWhxZj     318.01       58.00     Lights not visible
XtGKtILdiQDJ     156.72       22.91     Lights not visible
JBcJRnDcddRp     258.56       47.32     Lights not visible
UtWlRlzzbuXo     180.88       49.68     Lights not visible
aNOJiVoqNKvH     202.72       40.85     Lights not visible
GJSxaMuqHkhX     165.74       22.01     Lights not visible
qsFEdUJoxOkv     238.85       43.36     Lights not visible
wfUxfPSyLjHv     214.12       34.95     Lights not visible
FOgGNaDLHGyj     277.97       25.65     Lights not visible
zosKugNnaJpi     194.74       39.72     Lights not visible
NOxjmskHwoML      92.77       42.46     Lights not visible
LqWmvhmOpByw      18.69       39.35     Lights not visible
XpaknTuazODW      66.12       52.50     Lights not visible
QDstXAYqXcXw      45.42       57.92     Lights not visible
cDOaXPmBlsxK     179.28       54.89     Lights not visible
dykcbTvXxJot     162.16       28.27     Lights not visible
kcATUgDpwYAa     201.90       29.63     Lights not visible
ysTZvdySXBfv     280.45       13.06     Lights not visible
PHzaMNNimuCt     166.23       46.05     Lights not visible
pHWJzKCmPxxZ     252.39       31.37     Lights not visible
iYXqerieXfsD     143.51       52.38     Lights not visible
wJFBLZBnatHd      89.41       40.67     Lights not visible
KNuhkETwasnq     348.87       51.61     Lights not visible
fFgPVrjZlmjN     192.60       48.70     Lights not visible
BAcFCZBhUxav     279.22       52.26     Lights not visible
SCMVDwmNWUDC     275.03       26.16     Lights not visible
ULmCwWkLbQVS     116.02       75.87     Lights not visible
ggazSuZfHXJJ     292.71       44.79     Lights not visible
NmjvuNcyewoH      24.32       30.91     Lights not visible
VZIZuwfLtqXY     257.51       36.25     Lights not visible
KEbLYraNxUmI     143.27       51.00     Lights not visible
AowxtXUzWUPB     357.13       32.42     Lights not visible
knBcBjDjiilp      94.26       44.51     Lights not visible
dQvtEhLlbVQZ     236.40       49.51     Lights not visible
QyhxDIFewIEq     276.78       42.99     Lights not visible
mJfGMGtJnqmp     233.02       48.28     Lights not visible
iSPqjDywYTLY     345.84       57.18     Lights not visible
BvrLvekIayjE     288.09       73.23     Lights not visible
APhbibNwrLRz      84.89       58.08     Lights not visible
AfEIzyAUmhKn     129.87       65.37     Lights not visible
ZNtsWhFjRBHq     328.19       62.06     Lights not visible
vEYpfpHuaTWt     342.97       53.68     Lights not visible
iyrXxzeBekQI      47.27       19.52     Lights not visible
***************************************************************
Scenario: Ruben's Boat Data Set 1

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Degree-ship        0.00       90.00     Lights not visible
Another ship     359.97        5.00     Green Red Masthead
Ship               0.00        5.00     Green Masthead Red
Shippique        180.00        5.00     Masthead Stern
Sheep            214.30       10.00     Masthead Stern
Bowling-skibet   158.90        1.01     Stern Masthead
Katamari          47.80        1.02     Masthead Green
** Collision warning -->Ship:  Distance =  4.96
***************************************************************
Scenario: RerjFKtJfZFdIlCkUHdZURQUQuYKehbmhOQXvmWi

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
QpFKCqEMBUZo     205.51        1.77     Masthead Stern
***************************************************************

sjn
Learning poster
Posts: 73
Joined: Mon Apr 08, 2002 8:22 am
Contact:

hi

Post by sjn » Mon Apr 09, 2007 8:19 am

I have some concern here:

1) if the bearing is 359.995 < 0.00 but the output should be 0.00, then what is its light configurations?

Green Masthead Red or Green Red Masthead?

2) if the bearing is 0.001 > 0.00 but the output should also be 0.00, then what is its light configurations?

Green Masthead Red or Masthead Green Red?

thx in advance

r2ro
New poster
Posts: 38
Joined: Thu Sep 25, 2008 9:26 am

203 - Running Lights Visibility Calculator

Post by r2ro » Thu Oct 29, 2009 12:12 pm

I have tried to solve this problem out...

Although, the only thing left in my code right now (Which is still WA) is the calculation of bearings correctly. I am very uncertain as to how the bearing can be calculated, although it should begin from the other ships towards your ship.

Code: Select all

fy = fAbs (own_ship.yCor - ships[i].yCor);
              fx = fAbs (own_ship.xCor - ships[i].xCor);
              if (fx != 0)
                 fTemp = fy / fx;
              else
                 fTemp = 0;
              fAngle = atan(fTemp) * 180 / PI;
              ships[i].fBearing =  ???????? // Still unsure here
              ships[i].fDistance = distance(ships[i].xCor,own_ship.xCor,ships[i].yCor,own_ship.yCor);
I come up with weird results in the ships.fBearing (which is the bearing of all the respective ships), because I am quite unsure as to how you compute for the bearing correctly.

Any ideas? Thanks in advance!

r2ro
New poster
Posts: 38
Joined: Thu Sep 25, 2008 9:26 am

Re: 203 - Running Lights Visibility Calculator

Post by r2ro » Fri Oct 30, 2009 3:56 am

Okay, I am not really certain if the reason for my WA is because of how I would format the output, or not. Maybe it has something to do with my bearings or not.

Someone please verify my output?

Input

Code: Select all

Sample Test Data Set 1
4
Ownship
0.0 0.0 90.0 10.0
Windswept
10.0 10.0 135.0 8.0
Footloose
-5.0 6.0 275.0 6.0
Crasher 1
0.0 9.0 135 14.14
Aquavit
-2.0 -2.0 294.0 15.0
Sample Test Data Set 2
5
Ownship
0.0 0.0 90.0 1.0
Sturmtebergh
0.0 9.0 180.0 1.0
Aldimere
0.3140954 9.0 180.0 1.0
Borand
0.4278773 9.8 180.0 1.0
Cornelius
0.3140954 -9.0 0.0 1.0
Daeron
0.4278773 -9.8 0.0 1.0
Zero other Ships
0
My own ship
0.0 0.0 90.0 1.0
Repeat Sample Test Data Set 1
4
Ownship
0.0 0.0 90.0 10.0
Aquavit
-2.0 -2.0 294.0 15.0
Crasher 1
0.0 9.0 135 14.14
Footloose
-5.0 6.0 275.0 6.0
Windswept
10.0 10.0 135.0 8.0
Repeat Sample Test Data Set 2
5
Ownship
0.0 0.0 90.0 1.0
Cornelius
0.3140954 -9.0 0.0 1.0
Aldimere
0.3140954 9.0 180.0 1.0
Daeron
0.4278773 -9.8 0.0 1.0
Borand
0.4278773 9.8 180.0 1.0
Sturmtebergh
0.0 9.0 180.0 1.0
Kalbo
1
Mine
0.0 -5.0 124 3.0
Hers
-5.0 0.0 90 40.40
Output

Code: Select all

Scenario: Sample Test Data Set 1

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Windswept         90.00       14.14     Lights not visible
Footloose        225.19        7.81     Masthead Stern
Crasher 1         45.00        9.00     Masthead Green
Aquavit          111.00        2.83     Stern Masthead Green
** Collision warning -->Crasher 1:  Distance =  8.50
***************************************************************
Scenario: Sample Test Data Set 2

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Sturmtebergh       0.00        9.00     Green Masthead Red
Aldimere           2.00        9.01     Green Masthead Red
Borand             2.50        9.81     Masthead Green
Cornelius        358.00        9.01     Green Masthead Red
Daeron           357.50        9.81     Red Masthead
** Collision warning -->Sturmtebergh:  Distance =  8.95
** Collision warning -->Aldimere:  Distance =  8.95
** Collision warning -->Borand:  Distance =  9.76
** Collision warning -->Cornelius:  Distance =  8.95
** Collision warning -->Daeron:  Distance =  9.76
***************************************************************
Scenario: Zero other Ships

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
***************************************************************
Scenario: Repeat Sample Test Data Set 1

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Aquavit          111.00        2.83     Stern Masthead Green
Crasher 1         45.00        9.00     Masthead Green
Footloose        225.19        7.81     Masthead Stern
Windswept         90.00       14.14     Lights not visible
** Collision warning -->Crasher 1:  Distance =  8.50
***************************************************************
Scenario: Repeat Sample Test Data Set 2

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Cornelius        358.00        9.01     Green Masthead Red
Aldimere           2.00        9.01     Green Masthead Red
Daeron           357.50        9.81     Red Masthead
Borand             2.50        9.81     Masthead Green
Sturmtebergh       0.00        9.00     Green Masthead Red
** Collision warning -->Cornelius:  Distance =  8.95
** Collision warning -->Aldimere:  Distance =  8.95
** Collision warning -->Daeron:  Distance =  9.76
** Collision warning -->Borand:  Distance =  9.76
** Collision warning -->Sturmtebergh:  Distance =  8.95
***************************************************************
Scenario: Kalbo

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Hers              45.00        7.07     Masthead Green
** Collision warning -->Hers:  Distance =  5.96
***************************************************************
Here is how I format my output:

Code: Select all

fprintf(stdout, "%s",ships[i].name);
length = strlen(ships[i].name);
for (int j = length;j <= 16;j++)
    fprintf (stdout," ");
sprintf (str,"%.2f",ships[i].fBearing);
length = strlen(str);
for (int j = 0;j <= 5 - length;j++)
    fprintf (stdout," ");
fprintf (stdout,"%s",str);
length = strlen(str);
for (int j = 0;j <= 5;j++)
    fprintf (stdout," ");
sprintf (str,"%.2f",ships[i].fDistance);
length = strlen(str);
for (int j = 0;j <= 5 - length;j++)
    fprintf (stdout," ");
fprintf (stdout,"%s",str);
for (int j = 0;j <= 4;j++)
    fprintf (stdout," ");
fprintf (stdout,"%s",ships[i].light_Visibilities);
fprintf (stdout,"\n");
Also, the PI I am making use of is 3.14159265358979323846 instead of the 2*acos(0.0), as for some odd reason I get odd results when I make use of the latter.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 203 - Running Lights Visibility Calculator

Post by brianfry713 » Wed Jul 03, 2013 1:15 am

AC output for your input:

Code: Select all

Scenario: Sample Test Data Set 1

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Windswept         90.00       14.14     Lights not visible
Footloose        225.19        7.81     Masthead Stern
Crasher 1         45.00        9.00     Masthead Green
Aquavit          111.00        2.83     Stern Masthead Green
** Collision warning -->Crasher 1:  Distance =  8.50
***************************************************************
Scenario: Sample Test Data Set 2

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Sturmtebergh       0.00        9.00     Green Masthead Red
Aldimere           2.00        9.01     Masthead Green Red
Borand             2.50        9.81     Masthead Green
Cornelius        358.00        9.01     Green Red Masthead
Daeron           357.50        9.81     Red Masthead
** Collision warning -->Sturmtebergh:  Distance =  8.95
** Collision warning -->Aldimere:  Distance =  8.95
** Collision warning -->Borand:  Distance =  9.76
** Collision warning -->Cornelius:  Distance =  8.95
** Collision warning -->Daeron:  Distance =  9.76
***************************************************************
Scenario: Zero other Ships

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
***************************************************************
Scenario: Repeat Sample Test Data Set 1

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Aquavit          111.00        2.83     Stern Masthead Green
Crasher 1         45.00        9.00     Masthead Green
Footloose        225.19        7.81     Masthead Stern
Windswept         90.00       14.14     Lights not visible
** Collision warning -->Crasher 1:  Distance =  8.50
***************************************************************
Scenario: Repeat Sample Test Data Set 2

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Cornelius        358.00        9.01     Green Red Masthead
Aldimere           2.00        9.01     Masthead Green Red
Daeron           357.50        9.81     Red Masthead
Borand             2.50        9.81     Masthead Green
Sturmtebergh       0.00        9.00     Green Masthead Red
** Collision warning -->Cornelius:  Distance =  8.95
** Collision warning -->Aldimere:  Distance =  8.95
** Collision warning -->Daeron:  Distance =  9.76
** Collision warning -->Borand:  Distance =  9.76
** Collision warning -->Sturmtebergh:  Distance =  8.95
***************************************************************
Scenario: Kalbo

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Hers              45.00        7.07     Masthead Green
***************************************************************
I used M_PI.
Check input and AC output for thousands of problems on uDebug!

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 203 (Running Lights Visibility) -- can't get my bearings

Post by brianfry713 » Wed Jul 03, 2013 1:24 am

Input:

Code: Select all

in1
3
Ownship
0.0 0.0 0.0 1.0
Ship1
-0.0001 9.999 180.0 1.0
Ship2
0.0 9.999 180.0 1.0
Ship3
0.0001 9.999 180.0 1.0
AC output:

Code: Select all

Scenario: in1

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Ship1              0.00       10.00     Green Red Masthead
Ship2              0.00       10.00     Green Masthead Red
Ship3              0.00       10.00     Masthead Green Red
** Collision warning -->Ship1:  Distance =  9.90
** Collision warning -->Ship2:  Distance =  9.90
** Collision warning -->Ship3:  Distance =  9.90
***************************************************************
Check input and AC output for thousands of problems on uDebug!

r2ro
New poster
Posts: 38
Joined: Thu Sep 25, 2008 9:26 am

Re: 203 - Running Lights Visibility Calculator

Post by r2ro » Tue Oct 28, 2014 3:23 pm

Okay, I've decided to return to this problem...I basically re-did everything, noting that this problem is straight forward.

I've tried all the sample I/O in this thread, and they all match the output, but I keep getting WA!

Here is my code. I'm posting it for anyone's info. Basically, it's a very straight forward problem where you calculate the ships and their locations, their bearings, and then the lights that are visible. Could anyone tell me where it is failing or if there is something preventing it from getting AC? I took into consideration using long double for the bearings as previously mentioned here.

Code: Select all

Accepted! At last!
Here's some sample I/O which I clarified w/ uDebug

Input

Code: Select all

Sample Test Data Set 1
4
Ownship
0.0 0.0 90.0 10.0
Windswept
10.0 10.0 135.0 8.0
Footloose
-5.0 6.0 275.0 6.0
Crasher 1
0.0 9.0 135 14.14
Aquavit
-2.0 -2.0 294.0 15.0
Sample Test Data Set 2
5
Ownship
0.0 0.0 90.0 1.0
Sturmtebergh
0.0 9.0 180.0 1.0
Aldimere
0.3140954 9.0 180.0 1.0
Borand
0.4278773 9.8 180.0 1.0
Cornelius
0.3140954 -9.0 0.0 1.0
Daeron
0.4278773 -9.8 0.0 1.0
in1
3
Ownship
0.0 0.0 0.0 1.0
Ship1
-0.0001 9.999 180.0 1.0
Ship2
0.0 9.999 180.0 1.0
Ship3
0.0001 9.999 180.0 1.0
pQHMAlldFRVcGBkNDXfFzsTjRPgrnVsMCSYqeIeF
29
Ownship
38.4 72.8 296.2 13.5
WRnKcftSysaP
76.0 6.9 296.5 43.2
eupaOgOyfbpj
55.4 68.4 228.6 42.1
eWNRPXjLoAWX
2.3 43.8 109.2 22.3
OsZVtDnyyFxS
46.2 16.1 160.0 33.5
xrBNGOKtyNOU
69.6 11.1 260.1 9.9
TIJAypSmSjfG
11.7 81.4 271.2 98.9
ynRDPsTswDZo
48.4 87.2 83.7 86.7
jvwxRbdGLgUB
46.9 43.5 104.7 31.9
SpoGgKudoOBx
34.5 49.7 87.0 29.6
UeZHlUGEjqJn
6.4 32.1 52.4 25.4
JrzaulchFMIw
88.1 65.0 113.4 54.4
UnSssTKqCzEu
31.7 60.6 16.7 55.2
JpINedsraYma
15.6 39.6 87.7 2.1
unpSABZXHchE
89.2 66.0 93.6 14.3
pWqgoaMwDYXt
76.8 87.8 148.9 66.3
crbpOhKQuRzn
21.4 20.2 84.8 9.1
lzpIgLeduORR
91.1 28.1 148.4 15.6
wPWJLfAmIpPu
28.2 24.9 170.9 78.6
MaXNnhQrulfo
82.4 26.7 39.7 74.2
LDmcOkFjRXtO
23.2 92.8 280.1 93.4
lfIPyczIkaxg
69.9 43.8 293.2 70.0
GXtvRhBpibvB
1.6 43.0 58.8 28.6
oZKBjmsTsfOF
0.8 63.3 206.5 37.4
ZuZWIuPXqlUV
87.5 1.4 230.0 60.2
NfjAMcFKiuuI
30.4 62.8 112.5 58.0
KbckZzODKhZF
47.2 85.3 216.3 34.7
PZkoUdtxJker
23.4 26.4 65.5 25.5
OWtpPciKlyiR
81.5 91.7 132.8 68.8
nVZDyNYdumHE
81.4 8.4 249.5 21.4
ogFZvqXWmxYGDAZGVokgCmmRHyYGJKkzAXKOZMuZ
67
Ownship
45.6 39.6 231.4 23.2
diCyuFBSEygv
25.7 99.4 271.9 32.1
FRrskTDHRIbz
83.2 62.4 240.1 40.9
paAWEJchrvjS
90.9 72.5 15.2 32.7
npYgIOqWwZQe
52.9 21.8 230.0 49.2
vIPLyMmukHED
36.3 82.3 296.6 95.3
GpFDJJWqUqIv
54.0 15.6 190.1 75.5
guLjusabLmqM
13.0 73.7 132.1 87.7
QTdEmcbrtEYw
43.1 69.3 139.5 17.4
MAawvsBOoLHp
19.4 31.3 283.4 96.5
KFgyHCySEZTo
47.6 98.9 310.3 67.5
hiRQjWJmpHeq
78.0 5.7 73.6 7.2
JcyfviUEgidC
54.6 78.1 91.1 52.4
AunGpOyoCqkM
56.6 29.6 289.9 77.4
HdmhQAHRtfAl
68.1 79.6 323.7 70.4
clEJMnRyZirn
60.2 5.5 60.4 57.6
RuxrUEjBxyfK
9.8 89.8 195.2 78.3
dxDvCuDCXAds
28.0 60.5 92.2 86.9
gvJoOLkgFPPK
78.0 63.9 139.3 61.8
xZqlVbwXiFfC
11.0 68.2 297.3 74.9
WBqCHBJlMQgM
65.5 70.0 211.8 7.9
lGfPusucyvHP
2.2 95.8 181.3 66.4
xfPpfLpPefmK
99.5 70.4 163.3 8.0
muMtpnmDySvP
99.1 82.5 137.8 36.7
FUHEKkSmNNaX
13.7 44.3 150.5 72.5
QPFVUSFWhxZj
30.5 95.6 206.9 59.3
XtGKtILdiQDJ
53.5 18.1 183.1 86.8
JBcJRnDcddRp
75.6 3.0 62.1 55.8
UtWlRlzzbuXo
88.0 65.5 57.7 25.5
aNOJiVoqNKvH
4.9 43.1 252.2 30.2
GJSxaMuqHkhX
62.5 25.5 144.1 74.9
qsFEdUJoxOkv
74.3 7.1 79.7 4.2
wfUxfPSyLjHv
10.7 41.5 239.0 67.8
FOgGNaDLHGyj
35.8 15.9 104.5 28.1
zosKugNnaJpi
83.1 52.7 56.0 44.2
NOxjmskHwoML
27.9 78.2 62.6 0.3
LqWmvhmOpByw
43.6 78.9 158.4 42.6
XpaknTuazODW
38.4 91.6 106.0 88.8
QDstXAYqXcXw
84.3 82.7 176.5 66.9
cDOaXPmBlsxK
0.3 70.6 305.1 56.9
dykcbTvXxJot
73.8 37.6 111.9 91.5
kcATUgDpwYAa
17.5 30.2 229.6 84.5
ysTZvdySXBfv
34.7 46.8 203.0 66.9
PHzaMNNimuCt
53.3 85.0 23.4 63.6
pHWJzKCmPxxZ
29.3 66.4 256.3 9.8
iYXqerieXfsD
88.4 9.4 161.7 10.2
wJFBLZBnatHd
73.6 69.1 134.1 22.6
KNuhkETwasnq
97.2 40.8 279.8 74.8
fFgPVrjZlmjN
89.3 18.1 103.6 86.9
BAcFCZBhUxav
90.1 12.2 22.4 78.9
SCMVDwmNWUDC
33.9 63.0 238.4 34.7
ULmCwWkLbQVS
95.1 97.1 104.7 32.1
ggazSuZfHXJJ
23.4 0.7 97.0 58.9
NmjvuNcyewoH
39.5 69.9 144.3 8.8
VZIZuwfLtqXY
79.4 52.7 351.3 4.2
KEbLYraNxUmI
86.4 9.0 163.6 42.7
AowxtXUzWUPB
18.0 56.6 124.5 80.2
knBcBjDjiilp
80.6 12.1 213.9 25.7
dQvtEhLlbVQZ
2.3 15.6 184.6 32.6
QyhxDIFewIEq
80.5 64.7 317.5 1.8
mJfGMGtJnqmp
6.7 68.2 253.3 22.9
iSPqjDywYTLY
95.0 10.8 314.4 17.4
BvrLvekIayjE
94.4 94.2 293.7 26.3
APhbibNwrLRz
28.8 95.2 78.3 40.6
AfEIzyAUmhKn
4.7 90.6 11.4 40.4
ZNtsWhFjRBHq
3.5 85.2 169.1 21.7
vEYpfpHuaTWt
95.0 60.6 264.0 15.6
iyrXxzeBekQI
64.8 43.1 212.4 41.5
Here's a sample data value
5
Ownship
0.0 0.0 0.0 1.0
Degree-ship
0.003 -90.0 0 1.0
Another ship
0.003 -5.0 0 0.3
Ship
0 -5.0 0 1.9
Shippique
0 -5.0 180 1.9
UFO Sheep
10.0 0.0 55.7 1.0
RerjFKtJfZFdIlCkUHdZURQUQuYKehbmhOQXvmWi
1
Ownship
21.8 17.0 113.0 82.3
QpFKCqEMBUZo
23.5 17.5 48.1 91.9
Sample Test Data Set doh
5
Ownship
0.0 0.0 90.0 1.0
Sturmtebergh
0.0 9.0 180.0 1.1
Aldimere
0.3140954 9.0 180.0 1.0
Borand
0.4278773 9.8 180.0 1.0
Cornelius
0.3140954 -9.0 0.0 1.0
Daeron
0.4278773 -9.8 0.0 1.0
Check again
1
Mine
0.0 -5.0 124 3.0
Hers
-5.0 0.0 90 40.40
Output

Code: Select all

Scenario: Sample Test Data Set 1

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Windswept         90.00       14.14     Lights not visible
Footloose        225.19        7.81     Masthead Stern
Crasher 1         45.00        9.00     Masthead Green
Aquavit          111.00        2.83     Stern Masthead Green
** Collision warning -->Crasher 1:  Distance =  8.50
***************************************************************
Scenario: Sample Test Data Set 2

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Sturmtebergh       0.00        9.00     Green Masthead Red
Aldimere           2.00        9.01     Masthead Green Red
Borand             2.50        9.81     Masthead Green
Cornelius        358.00        9.01     Green Red Masthead
Daeron           357.50        9.81     Red Masthead
** Collision warning -->Sturmtebergh:  Distance =  8.95
** Collision warning -->Aldimere:  Distance =  8.95
** Collision warning -->Borand:  Distance =  9.76
** Collision warning -->Cornelius:  Distance =  8.95
** Collision warning -->Daeron:  Distance =  9.76
***************************************************************
Scenario: in1

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Ship1              0.00       10.00     Green Red Masthead
Ship2              0.00       10.00     Green Masthead Red
Ship3              0.00       10.00     Masthead Green Red
** Collision warning -->Ship1:  Distance =  9.90
** Collision warning -->Ship2:  Distance =  9.90
** Collision warning -->Ship3:  Distance =  9.90
***************************************************************
Scenario: pQHMAlldFRVcGBkNDXfFzsTjRPgrnVsMCSYqeIeF

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
WRnKcftSysaP      33.79       75.87     Lights not visible
eupaOgOyfbpj      55.91       17.56     Lights not visible
eWNRPXjLoAWX     302.02       46.31     Lights not visible
OsZVtDnyyFxS     192.17       57.23     Lights not visible
xrBNGOKtyNOU      73.08       69.14     Lights not visible
TIJAypSmSjfG     196.65       28.05     Lights not visible
ynRDPsTswDZo     131.08       17.53     Lights not visible
jvwxRbdGLgUB     239.12       30.51     Lights not visible
SpoGgKudoOBx     282.58       23.43     Lights not visible
UeZHlUGEjqJn     345.78       51.77     Lights not visible
JrzaulchFMIw     165.52       50.31     Lights not visible
UnSssTKqCzEu      12.07       13.92     Lights not visible
JpINedsraYma     306.78       40.28     Lights not visible
unpSABZXHchE     184.02       51.25     Lights not visible
pWqgoaMwDYXt      99.76       41.23     Lights not visible
crbpOhKQuRzn     293.11       55.28     Lights not visible
lzpIgLeduORR     161.90       69.10     Lights not visible
wPWJLfAmIpPu     201.12       48.97     Lights not visible
MaXNnhQrulfo     276.64       63.73     Lights not visible
LDmcOkFjRXtO     222.67       25.12     Lights not visible
lfIPyczIkaxg      19.43       42.82     Lights not visible
GXtvRhBpibvB     352.20       47.35     Lights not visible
oZKBjmsTsfOF     229.32       38.78     Lights not visible
ZuZWIuPXqlUV      95.48       86.65     Lights not visible
NfjAMcFKiuuI     286.16       12.81     Lights not visible
KbckZzODKhZF     358.85       15.29     Lights not visible
PZkoUdtxJker     312.41       48.76     Lights not visible
OWtpPciKlyiR     113.52       47.06     Lights not visible
nVZDyNYdumHE      76.77       77.44     Lights not visible
***************************************************************
Scenario: ogFZvqXWmxYGDAZGVokgCmmRHyYGJKkzAXKOZMuZ

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
diCyuFBSEygv     249.69       63.02     Lights not visible
FRrskTDHRIbz     358.67       43.97     Lights not visible
paAWEJchrvjS     218.81       55.99     Lights not visible
npYgIOqWwZQe     107.70       19.24     Lights not visible
vIPLyMmukHED     231.11       43.70     Lights not visible
GpFDJJWqUqIv     150.61       25.43     Lights not visible
guLjusabLmqM       4.19       47.18     Lights not visible
QTdEmcbrtEYw      35.69       29.81     Lights not visible
MAawvsBOoLHp     149.02       27.48     Lights not visible
KFgyHCySEZTo     231.63       59.33     Lights not visible
hiRQjWJmpHeq     242.70       46.89     Lights not visible
JcyfviUEgidC     102.06       39.54     Lights not visible
AunGpOyoCqkM      22.37       14.87     Lights not visible
HdmhQAHRtfAl     245.66       45.89     Lights not visible
clEJMnRyZirn     276.42       37.09     Lights not visible
RuxrUEjBxyfK     309.31       61.66     Lights not visible
dxDvCuDCXAds      47.70       27.32     Lights not visible
gvJoOLkgFPPK      93.83       40.50     Lights not visible
xZqlVbwXiFfC     192.28       44.89     Lights not visible
WBqCHBJlMQgM       1.41       36.33     Lights not visible
lGfPusucyvHP     321.02       71.01     Lights not visible
xfPpfLpPefmK      76.96       62.08     Lights not visible
muMtpnmDySvP      93.47       68.58     Lights not visible
FUHEKkSmNNaX     307.88       32.24     Lights not visible
QPFVUSFWhxZj     318.01       58.00     Lights not visible
XtGKtILdiQDJ     156.72       22.91     Lights not visible
JBcJRnDcddRp     258.56       47.32     Lights not visible
UtWlRlzzbuXo     180.88       49.68     Lights not visible
aNOJiVoqNKvH     202.72       40.85     Lights not visible
GJSxaMuqHkhX     165.74       22.01     Lights not visible
qsFEdUJoxOkv     238.85       43.36     Lights not visible
wfUxfPSyLjHv     214.12       34.95     Lights not visible
FOgGNaDLHGyj     277.97       25.65     Lights not visible
zosKugNnaJpi     194.74       39.72     Lights not visible
NOxjmskHwoML      92.77       42.46     Lights not visible
LqWmvhmOpByw      18.69       39.35     Lights not visible
XpaknTuazODW      66.12       52.50     Lights not visible
QDstXAYqXcXw      45.42       57.92     Lights not visible
cDOaXPmBlsxK     179.28       54.89     Lights not visible
dykcbTvXxJot     162.16       28.27     Lights not visible
kcATUgDpwYAa     201.90       29.63     Lights not visible
ysTZvdySXBfv     280.45       13.06     Lights not visible
PHzaMNNimuCt     166.23       46.05     Lights not visible
pHWJzKCmPxxZ     252.39       31.37     Lights not visible
iYXqerieXfsD     143.51       52.38     Lights not visible
wJFBLZBnatHd      89.41       40.67     Lights not visible
KNuhkETwasnq     348.87       51.61     Lights not visible
fFgPVrjZlmjN     192.60       48.70     Lights not visible
BAcFCZBhUxav     279.22       52.26     Lights not visible
SCMVDwmNWUDC     275.03       26.16     Lights not visible
ULmCwWkLbQVS     116.02       75.87     Lights not visible
ggazSuZfHXJJ     292.71       44.79     Lights not visible
NmjvuNcyewoH      24.32       30.91     Lights not visible
VZIZuwfLtqXY     257.51       36.25     Lights not visible
KEbLYraNxUmI     143.27       51.00     Lights not visible
AowxtXUzWUPB     357.13       32.42     Lights not visible
knBcBjDjiilp      94.26       44.51     Lights not visible
dQvtEhLlbVQZ     236.40       49.51     Lights not visible
QyhxDIFewIEq     276.78       42.99     Lights not visible
mJfGMGtJnqmp     233.02       48.28     Lights not visible
iSPqjDywYTLY     345.84       57.18     Lights not visible
BvrLvekIayjE     288.09       73.23     Lights not visible
APhbibNwrLRz      84.89       58.08     Lights not visible
AfEIzyAUmhKn     129.87       65.37     Lights not visible
ZNtsWhFjRBHq     328.19       62.06     Lights not visible
vEYpfpHuaTWt     342.97       53.68     Lights not visible
iyrXxzeBekQI      47.27       19.52     Lights not visible
***************************************************************
Scenario: Here's a sample data value

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Degree-ship        0.00       90.00     Lights not visible
Another ship     359.97        5.00     Green Red Masthead
Ship               0.00        5.00     Green Masthead Red
Shippique        180.00        5.00     Masthead Stern
UFO Sheep        214.30       10.00     Masthead Stern
** Collision warning -->Ship:  Distance =  4.96
***************************************************************
Scenario: RerjFKtJfZFdIlCkUHdZURQUQuYKehbmhOQXvmWi

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
QpFKCqEMBUZo     205.51        1.77     Masthead Stern
***************************************************************
Scenario: Sample Test Data Set doh

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Sturmtebergh       0.00        9.00     Green Masthead Red
Aldimere           2.00        9.01     Masthead Green Red
Borand             2.50        9.81     Masthead Green
Cornelius        358.00        9.01     Green Red Masthead
Daeron           357.50        9.81     Red Masthead
** Collision warning -->Sturmtebergh:  Distance =  8.95
** Collision warning -->Aldimere:  Distance =  8.95
** Collision warning -->Borand:  Distance =  9.76
** Collision warning -->Cornelius:  Distance =  8.95
** Collision warning -->Daeron:  Distance =  9.76
***************************************************************
Scenario: Check again

Boat ID         Bearing      Distance   Lights (left to right)
---------------------------------------------------------------
Hers              45.00        7.07     Masthead Green
***************************************************************
Last edited by r2ro on Tue Nov 04, 2014 2:20 am, edited 1 time in total.

Post Reply

Return to “Volume 2 (200-299)”