/* * This class holds scan data so that we can remember where enemies were * and what they were doing when we last scanned then. * You could make a hashtable (with the name of the enemy bot as key) * or a vector of these so that you can remember where all of your enemies are * in relation to you. * This class also holds the guessX and guessY methods. These return where our targeting * system thinks they will be if they travel in a straight line at the same speed * as they are travelling now. You just need to pass the time at which you want to know * where they will be. */ class Enemy { /* * ok, we should really be using accessors and mutators here, * (i.e getName() and setName()) but life's too short. */ String name; public double bearing; public double head; //enemy heading public long ctime; //game time that the scan was produced public double speed; public double x,y; public double distance; public double guessX(long when) { long diff = when - ctime; return x+Math.sin(head)*speed*diff; } public double guessY(long when) { long diff = when - ctime; return y+Math.cos(head)*speed*diff; } }