// Collision detection test // // Author Matthew Caryl // Created 26.5.97 package Test; class Bot { public int x, y; public int r; public int dx, dy; public boolean collision; public int ox, oy; public Bot next, prev; public Bucket home; public boolean outside() { return x < home.left || x > home.right || y < home.top || y > home.bottom; } public void add(Bucket H) { home = H; // add bot beyond dummy head of circular linked list next = home.bots.next; prev = home.bots; home.bots.next.prev = this; home.bots.next = this; } public void sub() { // remove bot from circular linked list next.prev = prev; prev.next = next; home = null; next = null; prev = null; } } class Bucket { public Bucket north; public Bucket east; public Bucket south; public Bucket west; public int top; public int left; public int bottom; public int right; public Bot bots; }