Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GetThere/Final Maps - Get There /Campus Map.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified GetThere/MapList.ser
Binary file not shown.
217 changes: 156 additions & 61 deletions GetThere/src/DevGUI.java

Large diffs are not rendered by default.

84 changes: 72 additions & 12 deletions GetThere/src/Djikstra.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public LinkedList<Node> navigate(Node start, Node goal){
return path;
}

public LinkedList<Node> nearestBathroom(Node start){
public LinkedList<Node> nearestSpecialNode(Node start, NodeType type){
if(start == null){
throw new IllegalArgumentException();
}
Expand All @@ -83,7 +83,7 @@ public LinkedList<Node> nearestBathroom(Node start){
frontier.add(start);
LinkedList<Node> temp = new LinkedList<Node>();
LinkedList<Node> path = new LinkedList<Node>();
if(start.getType() == (NodeType.BATHROOM)){
if(start.getType() == type){
path.add(start);
return path;
}
Expand All @@ -95,7 +95,7 @@ public LinkedList<Node> nearestBathroom(Node start){

while (!(frontier.isEmpty())){
current = frontier.poll(); // possibly use remove
if(current.getType() == (NodeType.BATHROOM)){
if(current.getType() == type){
break;
}
possibleNodes = current.getPossibleNodes();
Expand Down Expand Up @@ -170,52 +170,112 @@ else if (path.size() == 1){
current = path.removeFirst();
next = path.removeFirst();
counter +=1;
result += counter + ". " + "Walk " + current.getCost(next) + "\n";
int nextCost = current.getCost(next);
if(nextCost != 0){
result += counter + ". " + "Walk " + nextCost + " ft"+ "\n";
}
else{
if(current.getType().equals(NodeType.STAIRS)){
result += counter + ". " + "Take the stairs "+ "\n";
}
else if (current.getType().equals(NodeType.ELEVATOR)){
result += counter + ". " + "Take the elevator"+ "\n";
}
}
boolean straightFlag = false;
int straightValue = 0;
boolean straightPrintFlag = false;
while(path.size() > 0){

previous = current;
current = next;
next = path.removeFirst();
nextCost = current.getCost(next);
if (nextCost == 0){
if(current.getType().equals(NodeType.STAIRS)){
result += counter + ". " + "Take the stairs "+ "\n";
}
else if (current.getType().equals(NodeType.ELEVATOR)){
result += counter + ". " + "Take the elevator"+ "\n";
}
}
// double a = Math.sqrt((Math.pow(next.getX() - previous.getX(),2)) + (Math.pow(next.getY() - previous.getY(),2)));
// double b = Math.sqrt((Math.pow(next.getX() - current.getX(),2)) + (Math.pow(next.getY() - current.getY(),2)));
// double c = Math.sqrt((Math.pow(current.getX() - previous.getX(),2)) + (Math.pow(current.getY() - previous.getY(),2)));
// int angle = (int) Math.toDegrees(Math.acos((b*b + c*c - a*a)/(2*b*c)));
else{
int angle = (int) Math.toDegrees((Math.atan2(next.getY()-current.getY(),next.getX()-current.getX()) - Math.atan2(current.getY()-previous.getY(),current.getX()-previous.getX())));
//result += "Angle = " + angle + " \n";
if(angle < 10 && angle > -10){
if (!straightFlag){
counter +=1;
result += counter + ". " +"Keep straight and ";
straightFlag = true;
straightValue += nextCost;
}
else {
straightValue += nextCost;
}
}

else{
if(straightFlag){
result += "walk " + straightValue + " ft" + "\n";
straightValue = 0;
straightFlag = false;

}

if(angle < -65 && angle > -115){
counter +=1;
result += counter + ". " +"Take a left and ";
result += counter + ". " +"Take a left and ";
result += "walk " + nextCost + " ft" + "\n";

}
else if(angle > 65 && angle < 115){
counter +=1;
result += counter + ". " +"Take a right and ";
result += "walk " + nextCost + " ft" + "\n";

}
else if(angle < 65 && angle > 10){
counter +=1;
result += counter + ". " +"Take a slight right and ";
result += "walk " + nextCost + " ft" + "\n";
}
else if(angle < -10 && angle > -65){
counter +=1;
result += counter + ". " +"Take a slight left and ";
result += "walk " + nextCost + " ft" + "\n";
}
else if (angle == 180 || angle == -180){
counter +=1;
result += counter + ". " +"retrace your steps and contact whoever wrote this code, cause he screwed up, then ";
result += "walk " + nextCost + " ft" + "\n";
}
else if(angle > 115){
counter +=1;
result += counter + ". " +"Take a hard right and ";
}
else if(angle < -115){
counter +=1;
result += counter + ". " +"Take a hard left and ";
result += "walk " + nextCost + " ft" + "\n";
}
else if(angle < 10 && angle > -10){
else if(angle < -115){
counter +=1;
result += counter + ". " +"Keep straight and ";
result += counter + ". " +"Take a hard right and ";
result += "walk " + nextCost + " ft" + "\n";
}
result += "walk " + current.getCost(next) + " \n";



}
}
}
counter +=1;
if(straightFlag){
result += "walk " + straightValue + " ft \n";
straightValue = 0;
straightFlag = false;

}
result += counter + ". " + "You have reached your destination \n";

return result;
Expand Down
Loading