SnakeBot Implementierung
This commit is contained in:
parent
6ae2f8dc63
commit
e4483c8064
49
SnakeBot.java
Normal file
49
SnakeBot.java
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class SnakeBot extends Bot {
|
||||
|
||||
// int rounds = ;
|
||||
int steps = 1;
|
||||
public SnakeBot(String [] args) {
|
||||
super(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char nextMove(View view) throws Exception {
|
||||
|
||||
rounds++;
|
||||
|
||||
switch(rounds){
|
||||
case 3:
|
||||
rounds = 0;
|
||||
move(steps);
|
||||
steps++;
|
||||
return '<';
|
||||
default:
|
||||
move(steps);
|
||||
steps++;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public char move(int s){
|
||||
for(int i = 0; i < s; i++){
|
||||
return '^';
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
SnakeBot bot = new SnakeBot(args);
|
||||
bot.run();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user