Jump to navigation Jump to search

Hi. Not sure if this is still in progress, but i touched it a little and came up with this (128 byte and max user velocity) :

class NanoSim {
    public static double	x, y, h, v;
    public static double simulate(double att, double d, double maxv) {
      if (d == 0) d = Math.signum(v);
      if (v * d < 0) d *= 2;
      if (((d = v + d) * v) < 0) d /= 2.0;
      double r = limit(Rules.getTurnRateRadians(v), att);
      x += Math.sin(h = Utils.normalNearAbsoluteAngle(h + r)) * (v = limit(maxv, d));
      y += Math.cos(h) * v;
      return att - r;

    private static double limit(double minmax, double value) {
      return Math.max(-minmax, Math.min(value, minmax));

At least it makes the same as the old NanoSim. Not sure if it is sound i have to check it later a little more seriously. But eventually it helps a little and shows the direction.

EDIT: Well after playing with the LocationBot it turned out i had to change it. Simulate now gives the rest att back and can be used for the next step. If the direction (d) is correct it works quite nice (there is a little glitch if the bot begins to get straight but most of the time he is right and ends up at the the predicted coordinates). One issue is still to find the right direction. Has anyone an idea how to get the right direction?

Wompi23:38, 14 September 2012