@@ -0,0 +1,62 @@ | |||
package Prak1; | |||
import java.io.BufferedReader; | |||
import java.io.InputStreamReader; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
import java.net.Socket; | |||
import java.net.InetSocketAddress; | |||
public class SnakeBot extends Bot { | |||
private int steps = 1; | |||
private int counter = 0; | |||
private char lastCommand = '^'; | |||
private int zuGehen = 1; | |||
private int gegangen = 0; | |||
boolean amDrehen = false; | |||
boolean amGehen = true; | |||
int x =0; | |||
public SnakeBot(String[] args) { | |||
super(args); | |||
} | |||
@Override | |||
protected char nextMove(View view) { | |||
char command; | |||
if(x<4){ | |||
if(amGehen && gegangen < zuGehen){ | |||
gegangen +=1; | |||
return '^'; | |||
}else{ | |||
x += 1; | |||
gegangen =0; | |||
return '>'; | |||
} | |||
} | |||
else{ | |||
x=0; | |||
zuGehen +=2; | |||
gegangen =0; | |||
return '^'; | |||
} | |||
} | |||
private char drehen() { | |||
return 'd'; | |||
} | |||
private char gehen() { | |||
return 'w'; | |||
} | |||
public static void main(String[] args) { | |||
new SnakeBot(args).run(); | |||
} | |||
} |
@@ -0,0 +1,63 @@ | |||
package Prak1; | |||
import java.io.BufferedReader; | |||
import java.io.InputStreamReader; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
import java.net.Socket; | |||
import java.net.InetSocketAddress; | |||
public class battleBot extends Bot { | |||
private int steps = 1; | |||
private int counter = 0; | |||
private char lastCommand = '^'; | |||
private int zuGehen = 1; | |||
private int gegangen = 0; | |||
boolean amDrehen = false; | |||
boolean amGehen = true; | |||
int x =0; | |||
public battleBot(String[] args) { | |||
super(args); | |||
} | |||
@Override | |||
protected char nextMove(View view) { | |||
char command; | |||
if(x<4){ | |||
if(amGehen && gegangen < zuGehen){ | |||
gegangen +=1; | |||
return '^'; | |||
}else{ | |||
x += 1; | |||
gegangen =0; | |||
return '>'; | |||
} | |||
} | |||
else{ | |||
x=0; | |||
zuGehen +=2; | |||
gegangen =0; | |||
return 'f'; | |||
} | |||
} | |||
private char drehen() { | |||
return 'd'; | |||
} | |||
private char gehen() { | |||
return 'w'; | |||
} | |||
public static void main(String[] args) { | |||
new battleBot(args).run(); | |||
} | |||
} | |||