Diving into 3 - Methods and Classes 🤖

Why Use Methods?

Methods package related statements so you can call them whenever you need. This keeps run() clean and focused.

public void run() {
    initialize();
    while (true) {
        scanAndFire();
        moveAroundMap();
    }
}
 
public void initialize(){
    ...
}
public void scanAndFire(){
    ...
}
public void moveAroundMap(){
    ...
}

The modular code will be easier to add new behaviour to and will increase your bots efficiency.


⬅️ Back: Debugging with Patience ➡️ Next: Helper Methods