Cleaner code makes it easier to expand your robot’s abilities.
Refactor Checklist
- Extract Helper Methods – move repeated code from
run()
into named methods. - Clarify Names – choose descriptive method and variable names (
scanForEnemies()
instead ofcheck
). - Limit Long Methods – if a method grows past ~20 lines, consider splitting it.
- Comment Complex Logic – brief comments help others (and you) understand tricky sections.
- Consistent Formatting – use your IDE’s auto-formatting to keep braces and indentation tidy.
Refactoring keeps your bot maintainable while you iterate on new strategies.
Navigation
⬅️ Back: Survival Strategies ➡️ Next: Day 9: Robot Building!