Skip to content

Commit

Permalink
Merge branch 'savvy' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
SavvyLiu authored Mar 4, 2024
2 parents 44d9661 + 235b87c commit 219459f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
14 changes: 10 additions & 4 deletions src/main/java/ca/mcmaster/se2aa4/island/team101/AirDecision.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
public class AirDecision extends Decision {
private Drone drone;
//private JSONObject decision = new JSONObject();

private static final String FLY = "fly";
private static final String STOP = "stop";
private static final String HEADING = "heading";
private static final String ECHO = "echo";
private static final String SCAN = "scan";
// Command object
Command command = new Command();
Response response; // will be initialized accordidng to type -> using polymorphism
Compass direction = new Compass(); //NEED TO INITIALIZE HEADING
Compass direction = new Compass(); //NEED TO INITIALIZE HEADING

private int counter = 0;

private String lastCommand;
// use getters from drone to get other relevant info/objects for decision logic
// should only need emergency detector and battery through drone
// commands cover everything else i think
Expand All @@ -28,7 +32,7 @@ public String decide() {
// not sure how to return strings for turning...maybe need to change heading logic to work
// with however you turn in this, if there's a command to turn n/e/s/w, instead of DIY turning
// then those commands could be an option to return from here + add to String list in decision
if (counter > 1000){
if (counter > 20){
// just for the mvp, it checks for land and returns home immediately
// ideally, this is put into a method, but since its just temporary, itl just be done in the if statement
// need to implement a drone.goHomeCost() or something to figure out when to return, its being simulated by a simple counter for now
Expand All @@ -42,8 +46,10 @@ public String decide() {
//decision.put("action", ECHO);
//decision.put("parameters", parameters);
command.echo(EAST);
lastCommand = "echo";
}
else {
lastCommand = "fly";
command.fly();
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/ca/mcmaster/se2aa4/island/team101/AreaMap.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
package ca.mcmaster.se2aa4.island.team101;
import java.util.List; // keep it general ig
import java.util.ArrayList;
import java.util.HashMap;

public class AreaMap {
private List<String> creeks; //ids will be strings I suppose
private String emergencySite;
private Tile[][] map;

List<String> rows = new ArrayList<String>();
HashMap<Integer, ArrayList> map = new HashMap<Integer, ArrayList>();

public AreaMap(){
this.creeks = new ArrayList<String>(); // implementing it as arraylist but methods will work if u choose to change it here
// idk if this is a stupid idea or not or if we should just put it as an arraylist from the start here
}



public void addCreek(String creekID){
creeks.add(creekID);
}
Expand Down

0 comments on commit 219459f

Please sign in to comment.