public Location Run(Location location) { int x=location.getX(), y=location.getY(), d=location.getDirection(); if (d == 0) y -= speed; else if (d == 1) x += speed; else if (d == 2) y += speed; else if (d == 3) x -= speed; return new Location(x, y, d); }