Compare commits
No commits in common. "8c40d7bacb5c49ce587426f97d487a82c836ce0a" and "f3d09aabb65d9c5edfb1cb35b9ccc15bd82dc546" have entirely different histories.
8c40d7bacb
...
f3d09aabb6
@ -10,8 +10,7 @@ public class RumbleBot extends Bot {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
if(args.length == 0) {
|
if(args.length == 0) {
|
||||||
String[] dummyArgs = {"localhost", "63187"};
|
DummyBot dummy = new DummyBot(args);
|
||||||
DummyBot dummy = new DummyBot(dummyArgs);
|
|
||||||
new Thread(dummy).start();
|
new Thread(dummy).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,54 +46,13 @@ public class RumbleBot extends Bot {
|
|||||||
for (int i = 0; i < data.length(); i++) {
|
for (int i = 0; i < data.length(); i++) {
|
||||||
grid[i % size][i / size] = data.charAt(i);
|
grid[i % size][i / size] = data.charAt(i);
|
||||||
}
|
}
|
||||||
|
return markFiringLines(grid);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected char[][] markFiringLines(char[][] grid) {
|
||||||
return grid;
|
return grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void markFiringLines(char[][] grid) {
|
|
||||||
int size = grid.length;
|
|
||||||
for (int x = 0; x < size; x++) {
|
|
||||||
for (int y = 0; y < size; y++) {
|
|
||||||
|
|
||||||
if (grid[x][y] == 'v') {
|
|
||||||
int scanY = y;
|
|
||||||
while (scanY < size && !obstacles.contains("" + grid[x][y])) {
|
|
||||||
if (grid[x][scanY] == '.')
|
|
||||||
grid[x][scanY] = '*';
|
|
||||||
scanY++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grid[x][y] == '^') {
|
|
||||||
int scanY = y;
|
|
||||||
while (scanY >= 0 && !obstacles.contains("" + grid[x][y])) {
|
|
||||||
if (grid[x][scanY] == '.')
|
|
||||||
grid[x][scanY] = '*';
|
|
||||||
scanY--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grid[x][y] == '>') {
|
|
||||||
int scanX = x;
|
|
||||||
while (scanX < size && !obstacles.contains("" + grid[x][y])) {
|
|
||||||
if (grid[scanX][y] == '.')
|
|
||||||
grid[scanX][y] = '*';
|
|
||||||
scanX++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grid[x][y] == '<') {
|
|
||||||
int scanX = x;
|
|
||||||
while (scanX >= 0 && !obstacles.contains("" + grid[x][y])) {
|
|
||||||
if (grid[scanX][y] == '.')
|
|
||||||
grid[scanX][y] = '*';
|
|
||||||
scanX--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isInLineOfSight(char[][] grid) {
|
protected boolean isInLineOfSight(char[][] grid) {
|
||||||
int size = grid.length;
|
int size = grid.length;
|
||||||
for (int y = size / 2; y > 0; y--) {
|
for (int y = size / 2; y > 0; y--) {
|
||||||
@ -132,7 +90,6 @@ public class RumbleBot extends Bot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected char breadthFirstSearch(char[][] grid) {
|
protected char breadthFirstSearch(char[][] grid) {
|
||||||
markFiringLines(grid);
|
|
||||||
int size = grid.length;
|
int size = grid.length;
|
||||||
int start = size / 2;
|
int start = size / 2;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user