Exemple #1
0
  public static void main(String[] args) {
    debug = args.length > 0;
    long start = System.nanoTime();

    solve();
    out.flush();

    long end = System.nanoTime();
    dump((end - start) / 1000000 + " ms");
    in.close();
    out.close();
  }
Exemple #2
0
    CExplode(double x, double y) {
      for (int i = 0; i < particles.length; i++) {
        // particles[i][0] = new Ellipse2D.Double(x, y, 10, 10);
        particles[i][0] =
            new Arc2D.Double(
                x - 25, y - 25, 50, 50, 360 / particles.length * i, 360 / particles.length * 2, 0);
        particles[i][1] = rand.nextDouble() + rand.nextInt(3) - 1;
        particles[i][2] = rand.nextDouble() + rand.nextInt(3) - 1;

        created = System.nanoTime();
      }
    }
Exemple #3
0
 boolean render(Graphics2D map) {
   double diff = (System.nanoTime() - created) / 1000 / 1000;
   if (diff > timeAlive) return true;
   map.setColor(new Color(100, 100, 100, (int) (255 - (diff / timeAlive * 250))));
   for (int i = 0; i < particles.length; i++) {
     RectangularShape tmp = (RectangularShape) particles[i][0];
     double xD = (Double) particles[i][1];
     double yD = (Double) particles[i][2];
     tmp.setFrame(
         (double) tmp.getX() + xD / delta,
         (double) tmp.getY() + yD / delta,
         tmp.getWidth(),
         tmp.getHeight());
     map.draw(tmp);
   }
   return false;
 }