JExpress: Dead Robot Delivery Service

An ICFP `02 Programming Contest entry.

Brought to you by:
The Committee To Find Pat Tullmann a Job(*)
jexpress@tullmann.org

(*) The "Committee" is staffed exclusively by Pat Tullmann

Update

One of other contestants put up a neat page running different comparisions of the available bots: Visit NetDragons.com comparisons.

JExpress does reasonably well, until the 3rd trial. Where it goes into an infinite loop because it can't handle unreachable destinations. D'oh! There goes any chance I may have had...

Info

JExpress plays the game in a straightforward manner, picking a base to check out, picking up as many packages as it can, and delivering those packages. It isn't especially intelligent about picking bases (uses closest crow-flies-distance), nor about picking up packages (just first fit). It doesn't even try bidding (always bids 1). It does a better job about delivering to the most "valuable" destination, but it doesn't consider distance to travel (or even if it has enough funds to get there). It uses a textbook A* implementation to get around, though it re-computes the path on every turn (and I have a feeling this will be its downfall).

If it gets really desperate for something to do, it will look for random packages dropped on the map, or even for random robots to run into. Though none of that is really tested, so who knows what it will do.

Its written in Java, because that's what I know best. I should have stored the computed A* path, at least until it fell off the trail. I could really have used a cleaner mechanism to lazily process the server updates. But, I did manage to get 8 hours of sleep each night :)

Submitted tar file (source included): JExpress.tar.gz (requires JDK1.4 to run)

Notes:

  • Currently, the `bot is silent. To see it think, fix the 'msg' method in Robot.java.
  • To trace the code use -Dtrace=FOO (see Trace.java for suitable FOOs).
(Known) Shortcomings:
  • Never uses a bid value other than 1. (I wanted it to consider if other robots are nearby, and to thus increase the bid.)
  • Doesn't consider the package destinations when picking up packages.
  • Just does a first-fit when picking up packages.
  • Doesn't consider actual path length when picking a base to journey to (uses Manhattan distance).
  • Doesn't consider random dropped packages on the map until the bases are overly congested or empty.
  • Never got tested with a really large map
  • Server communication code is very fragile.
  • Error handling is non-existent, just throws Error(): terminating the entire app if anything goes wrong at most any level.
  • Re-computes A* path to destination every turn.
  • A* cannot take into account multiple goals (e.g., for pathing to all the bases).
  • Robot never goes on homicidal rampages
  • Hardly any comments
  • I left a lot of debug/tracing code in, and I doubt the JVM is smart enough to optimize it away.
webhead@tullmann.org
Last updated on Thursday, March 25, 2021