new method to check if a boat is between gates as well as updated the gps values to fit better with real life values

#story[1101]
This commit is contained in:
hba56
2017-08-02 18:09:12 +12:00
parent 13922bc284
commit b7af4e19cf
2 changed files with 37 additions and 3 deletions
@@ -206,6 +206,7 @@ public class MockBoat extends Boat {
/**
* Check if a mark is on the port side of the boat
* @param mark mark to be passed
* @return true if mark is on port side
*/
public boolean isPortSide(Mark mark){
//if this boat is lower than the mark check which way it is facing
@@ -219,6 +220,7 @@ public class MockBoat extends Boat {
/**
* Check if a mark is on the starboard side of the boat
* @param mark mark to be passed
* @return true if mark is on starboard side
*/
public boolean isStarboardSide(Mark mark){
//if this boat is lower than the mark check which way it is facing
@@ -229,4 +231,18 @@ public class MockBoat extends Boat {
}
}
/**
* Used to check if this boat is between a gate
* @param gate the gate to be checked
* @return true if the boat is between two marks that make up a gate
*/
public boolean isBetweenGate(CompoundMark gate){
if ((this.isPortSide(gate.getMark1()) && this.isStarboardSide(gate.getMark2())) ||
(this.isStarboardSide(gate.getMark2()) && this.isPortSide(gate.getMark1()))){
return true;
}else{
return false;
}
}
}