Browse Source

escape bot

master
Your Average Code 1 year ago
parent
commit
df3da42d84
2 changed files with 10 additions and 7 deletions
  1. 10
    5
      src/EscapeBot.java
  2. 0
    2
      src/ManualBot.java

+ 10
- 5
src/EscapeBot.java View File

boolean foundShip = false; boolean foundShip = false;
boolean offByOne = true; boolean offByOne = true;
int currentStepCount = 0; int currentStepCount = 0;
int steps = 0;
int steps = 10;


public static void main(String[] args) { public static void main(String[] args) {
Bot bot = new EscapeBot(args); Bot bot = new EscapeBot(args);


@Override @Override
protected char nextMove(View view) throws Exception { protected char nextMove(View view) throws Exception {
System.out.println();
if (view.data.contains("o")) { if (view.data.contains("o")) {
int index = view.data.indexOf('o'); int index = view.data.indexOf('o');
if(index > view.width * 2) {
if (index < view.width * 2 && !(index > view.width * 3)) {
return '^'; return '^';
} else if (index % 5 < 2) {
return '<';
} else if (index % 5 > 2) {
return '>';
} }
}
if (steps == 0) {
return ' ';
} else if (steps == 0) {
currentStepCount += 1; currentStepCount += 1;
if(offByOne) {
if (offByOne) {
currentStepCount += 1; currentStepCount += 1;
} }
offByOne = !offByOne; offByOne = !offByOne;

+ 0
- 2
src/ManualBot.java View File

import net.bytebuddy.implementation.bytecode.Throw;

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


public class ManualBot extends Bot { public class ManualBot extends Bot {

Loading…
Cancel
Save