battlecode-server-2017 icon indicating copy to clipboard operation
battlecode-server-2017 copied to clipboard

Callback methods in RobotController

Open kazimuth opened this issue 8 years ago • 0 comments

We currently allocate lots of arrays; that's slow.

It would be cool if we offered functions that took callbacks instead, like:

// in RobotController.java
void forEachInRange(float range, Consumer<ObjectInfo> function);
// in player code
void run(RobotController rc) {
  // ...
  rc.forEachInRange(10, (obj) => {
    System.out.println("I can see: "+obj);
  });
}

kazimuth avatar Dec 29 '16 03:12 kazimuth