If you have data structures/methods that you think could come in handy for others, edit this post with a basic description and instructions to use.
BFS (only on Player's current planet)
Description: Normal BFS, except with multiple starting locations. Returns a matrix of distances to closest location - to use, move bots to locations with minimal numbers.
Usage:
ArrayList\ arr = new ArrayList<>();
arr.add(new MapLocation(Planet.Earth, x1, y1));
arr.add(new MapLocation(Planet.Earth, x2, y2));
int[][] out = MapAnalysis.BFS(arr);
MapTools.RocketLanding (Earth only)
Description: Lets you request and retrieve optimal locations to send rockets to. For optimal performance, request 100 turns before retrieving, especially if you know the precise time of leaving, and are going to be sending over many rockets.
For more detailed info see the Javadocs for the methods (directly above them).
Usage:
RocketLanding.request(30, 10);
//100 turns later...
MapLocation x = RocketLanding.retrieve(0);
MapTools.Passable
Description: Lets you get a matrix of current planet's passability, and the number of total passable squares. In the matrix, 1 means passable, 0 means not passable.
Usage:
short pass = Passable.matrix(Planet.Earth)[y][x];
short total = Passable.total(Planet.Mars);
MapTools.Karbonite
Description: Returns the karbonite on a given planet at a given round as a matrix or a total. When requesting for Earth, round parameter has no effect. Does not account for collected karbonite.
Usage:
short pass = Karbonite.matrix(Planet.Mars, 750)[y][x];
int total = Karbonite.total(Planet.Earth, 999);
MapTools.UnionFind
Description: Runs union-find upon bot start and gives you access to a bunch of goodies that come with it. Specifically, you can check if two locations connect, and see a given chamber's size and contained karbonite. Also, you can get a set of all components, and get the id of a location.
Usage:
boolean b = UnionFind.connect(Planet.Earth, x1, y1, x2, y2);
int size = UnionFind.size(Planet.Mars, x, y);
int karb = UnionFind.karbonite(Planet.Mars, x, y);
for(int id : UnionFind.components(Planet.Mars)) karb = UnionFind.karbonite(Planet.Mars, id);
Is a Unit a moveable robot?
Description: It returns false for Factories and Rockets, true otherwise.
If you have data structures/methods that you think could come in handy for others, edit this post with a basic description and instructions to use.