Академический Документы
Профессиональный Документы
Культура Документы
}
if(turn == true){
pen.turn(90);
pen.move(length);
}
if(watch.equals("yes")){
try {
Thread.sleep(6);
}
catch (InterruptedException ie) {
// Handle the exception
}
}
}
}
public void chaos(){
Scanner multi = new Scanner( System.in ); //makes new copy of code
KeyboardReader reader = new KeyboardReader(); //makes new copy of code
DecimalFormat Dec = new DecimalFormat("0.0000"); //makes new copy of code
Timer timer = new Timer();
double length = 10, angle = 90;
int speed = 0;
System.out.println("Please enter initial angle of the pen");
angle = reader.readDouble();
StandardPen pen = new StandardPen();
pen.setColor(Color.red);
pen.setWidth(1);
for(int i = 0; i <= 1000000; i++){
pen.turn(angle);
pen.move(length);
angle = angle + Math.random();
try {
Thread.sleep(6);
}
catch (InterruptedException ie) {
// Handle the exception
}
}
}
public void pattern(){
Scanner multi = new Scanner( System.in ); //makes new copy of code
KeyboardReader reader = new KeyboardReader(); //makes new copy of code
DecimalFormat Dec = new DecimalFormat("0.0000"); //makes new copy of code
Timer timer = new Timer();
double length = 10, angle = 90;
int speed = 0;
System.out.println("Enter the initial angle to start the fractal.");
angle = reader.readDouble();;
StandardPen pen = new StandardPen();
pen.setColor(Color.green);
pen.setWidth(1);
for(int i = 0; i <= 1000000; i++){
pen.turn(angle);
pen.move(length);
angle = angle + i;
try {
Thread.sleep(6);
}
catch (InterruptedException ie) {