Browse Source

SnakeBot fertig

master
leonmcfly 3 months ago
parent
commit
7698381620
2 changed files with 17 additions and 3 deletions
  1. BIN
      out/production/Prog3/Praktikum05/RumbleBot.class
  2. 17
    3
      src/Praktikum05/RumbleBot.java

BIN
out/production/Prog3/Praktikum05/RumbleBot.class View File


+ 17
- 3
src/Praktikum05/RumbleBot.java View File

@@ -1,21 +1,34 @@
package Praktikum05;

import java.util.Random;
import java.util.Scanner;

public class RumbleBot extends Bot{
public class RumbleBot extends Bot {
protected RumbleBot(String[] args) {
super(args);
}

private Scanner input = new Scanner(System.in);

private int counter = 0;
private Random leftOrRight = new Random();
@Override
protected char nextMove(View view) throws Exception {
char roverKennung = view.data.charAt(40);
boolean exit = false;
while (!exit) {

input.close();
if(counter <= 8){
counter++;
return '^';
}else if(counter > 8){
counter = 0;
if(leftOrRight.nextBoolean()){
return '>';
}else{
return '<';
}
}

}
throw new Exception("Beendet");
}
@@ -27,4 +40,5 @@ public class RumbleBot extends Bot{
bot.run();
}


}

Loading…
Cancel
Save