Browse Source

escapebot draft

testing_N
Alina Ehrensberger 1 year ago
parent
commit
498bcb89c1
1 changed files with 37 additions and 0 deletions
  1. 37
    0
      src/EscapeBot.java

+ 37
- 0
src/EscapeBot.java View File

public class EscapeBot extends Bot{
boolean rocketDetected = false;
public static void main(String[] args) {

Bot escapeBot = new EscapeBot(args);
escapeBot.run();
}
protected EscapeBot(String[] args) {
super(args);
}

protected char nextMove(View view) throws Exception {
char[] viewField = view.data.toCharArray();


for (int i = 0; i < viewField.length; i++) {
if(viewField[i] == 'o'){
rocketDetected = true;
}
}

if(rocketDetected){

}else{
return randomWalk();
}

return 0;
}

private char randomWalk() {
return '^';
}


}


Loading…
Cancel
Save