updated comments

This commit is contained in:
Elias 2025-02-09 19:45:26 +01:00
parent 0d6feebb8e
commit e4dc5ec815

View File

@ -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 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 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 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)
@ -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;
}
if (isClearing) {
@ -86,7 +86,8 @@ public class SnakeBot extends Bot {
turnCount = 2;
straightLength++;
}
if (stepCounter < straightLength * viewRange) {
//if rover hasn't reached corner
if (stepCounter < straightLength * VIEWRANGE) {
stepCounter++;
return '^';
} else {
@ -101,9 +102,10 @@ public class SnakeBot extends Bot {
protected char clearFov(View view) {
char move;
//check if rover is at a corner of its search path
if (stepCounter >= straightLength * viewRange) {
if (stepCounter >= straightLength * VIEWRANGE) {
move = cornerClearSequence[clearSequenceCounter++];
//update rover state and reset sequence after its done
if (clearSequenceCounter >= cornerClearSequence.length) {
isClearing = false;
stepCounter = 2;
@ -113,6 +115,7 @@ public class SnakeBot extends Bot {
} else {
move = clearSequence[clearSequenceCounter++];
//update rover state and reset sequence after its done
if (clearSequenceCounter >= clearSequence.length) {
isClearing = false;
stepCounter += 2;