You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RumbleBot.java 972B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package Praktikum05;
  2. import java.util.Random;
  3. import java.util.Scanner;
  4. public class RumbleBot extends Bot {
  5. protected RumbleBot(String[] args) {
  6. super(args);
  7. }
  8. private Scanner input = new Scanner(System.in);
  9. private int counter = 0;
  10. private Random leftOrRight = new Random();
  11. @Override
  12. protected char nextMove(View view) throws Exception {
  13. char roverKennung = view.data.charAt(40);
  14. boolean exit = false;
  15. while (!exit) {
  16. if(counter <= 8){
  17. counter++;
  18. return '^';
  19. }else if(counter > 8){
  20. counter = 0;
  21. if(leftOrRight.nextBoolean()){
  22. return '>';
  23. }else{
  24. return '<';
  25. }
  26. }
  27. }
  28. throw new Exception("Beendet");
  29. }
  30. public static void main(String args[]){
  31. Bot bot = new RumbleBot(args);
  32. bot.run();
  33. }
  34. }