updated comments
This commit is contained in:
parent
0d6feebb8e
commit
e4dc5ec815
@ -4,7 +4,7 @@ public class SnakeBot extends Bot {
|
|||||||
int straightLength = 1; //length of the straight the bot still needs to travel(in "FOV-Tiles")
|
int straightLength = 1; //length of the straight the bot still needs to travel(in "FOV-Tiles")
|
||||||
int stepCounter = 0; //steps the bot has already taken on the straight
|
int stepCounter = 0; //steps the bot has already taken on the straight
|
||||||
int turnCount = 2; //amount of times the bot needs to turn before increasing straightLength
|
int turnCount = 2; //amount of times the bot needs to turn before increasing straightLength
|
||||||
int viewRange = 5; //distance from one end to the bots FOV to the other (assumes square FOV)
|
final int VIEWRANGE = 5; //distance from one end to the bots FOV to the other (assumes square FOV)
|
||||||
int wagonCount = 0; //amount of wagons the rover is currently pulling
|
int wagonCount = 0; //amount of wagons the rover is currently pulling
|
||||||
int angle = 0; //current angle of the rover, compared to its initial angle
|
int angle = 0; //current angle of the rover, compared to its initial angle
|
||||||
boolean isOnPath = true; //if the bot is on its normal search path (not pathing to a mineral)
|
boolean isOnPath = true; //if the bot is on its normal search path (not pathing to a mineral)
|
||||||
@ -76,7 +76,7 @@ public class SnakeBot extends Bot {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (stepCounter % 5 == 0 && !isClearing && view.data.contains("@")) {
|
if (stepCounter % VIEWRANGE == 0 && !isClearing && view.data.contains("@")) {
|
||||||
isClearing = true;
|
isClearing = true;
|
||||||
}
|
}
|
||||||
if (isClearing) {
|
if (isClearing) {
|
||||||
@ -86,7 +86,8 @@ public class SnakeBot extends Bot {
|
|||||||
turnCount = 2;
|
turnCount = 2;
|
||||||
straightLength++;
|
straightLength++;
|
||||||
}
|
}
|
||||||
if (stepCounter < straightLength * viewRange) {
|
//if rover hasn't reached corner
|
||||||
|
if (stepCounter < straightLength * VIEWRANGE) {
|
||||||
stepCounter++;
|
stepCounter++;
|
||||||
return '^';
|
return '^';
|
||||||
} else {
|
} else {
|
||||||
@ -101,9 +102,10 @@ public class SnakeBot extends Bot {
|
|||||||
protected char clearFov(View view) {
|
protected char clearFov(View view) {
|
||||||
char move;
|
char move;
|
||||||
//check if rover is at a corner of its search path
|
//check if rover is at a corner of its search path
|
||||||
if (stepCounter >= straightLength * viewRange) {
|
if (stepCounter >= straightLength * VIEWRANGE) {
|
||||||
move = cornerClearSequence[clearSequenceCounter++];
|
move = cornerClearSequence[clearSequenceCounter++];
|
||||||
|
|
||||||
|
//update rover state and reset sequence after its done
|
||||||
if (clearSequenceCounter >= cornerClearSequence.length) {
|
if (clearSequenceCounter >= cornerClearSequence.length) {
|
||||||
isClearing = false;
|
isClearing = false;
|
||||||
stepCounter = 2;
|
stepCounter = 2;
|
||||||
@ -113,6 +115,7 @@ public class SnakeBot extends Bot {
|
|||||||
} else {
|
} else {
|
||||||
move = clearSequence[clearSequenceCounter++];
|
move = clearSequence[clearSequenceCounter++];
|
||||||
|
|
||||||
|
//update rover state and reset sequence after its done
|
||||||
if (clearSequenceCounter >= clearSequence.length) {
|
if (clearSequenceCounter >= clearSequence.length) {
|
||||||
isClearing = false;
|
isClearing = false;
|
||||||
stepCounter += 2;
|
stepCounter += 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user