/* Attracteurs étranges */
import java.applet.Applet;
import java.awt.*;

public class Attractor extends Applet {
 public void init() {
  this.setBackground(new Color(255,255,255));
  this.setForeground(new Color(90,50,216));
 }
 public void destroy() { }
 public void paint(Graphics g) {
  int i, dx = 50, dy = 50, A, B;
  double P = Math.PI,a=P*(2*Math.random()-1),b=P*(2*Math.random()-1),
         c=P*(2*Math.random()-1),d=P*(2*Math.random()-1);
  double u=Math.random(),v=Math.random(),w=Math.random(), U,V,W;
  g.drawRect(0,0,199,199);
  for (i=0;i<=100000;i++){
     U = Math.sin(a*u)-w*Math.cos(b*v); V=w*Math.sin(c*v)-Math.cos(d*u); W=Math.sin(u);
     u=U; v=V; w=W; U=U+2; V=V+2; A=(int)(dx*U); B=(int)(dy*V);
     g.drawLine(A,B,A,B);
  }
 }
 public void dessine() {
   repaint();
 }
 public String getAppletInfo() { return "Attracteurs étranges"; }
}


