escapebot draft
This commit is contained in:
parent
b627544d6b
commit
498bcb89c1
37
src/EscapeBot.java
Normal file
37
src/EscapeBot.java
Normal file
@ -0,0 +1,37 @@
|
||||
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…
x
Reference in New Issue
Block a user