public static void main(String[] args) { Robot the = new Robot(); the.penDown(); the.setSpeed(300); the.setPenWidth(50); the.setPenColor(Color.PINK); for (int i = 0; i < 4; i++) { the.move(101); the.turn(630); } }
void go() { // 4. Make the robot move as fast as possible Chas.setSpeed(10); Chas.penDown(); // 5. Set the pen width to 5 Chas.setPenWidth(5); // 6. Do steps #7 to #8 four times... for (int i = 0; i < 4; i++) { // 7. Set the pen color to random Chas.setRandomPenColor(); // 1. Call the drawSquare() method drawSquare(); // 8. Turn the robot 90 degrees to the right Chas.turn(90); } }
public static void main(String[] args) { // 1. Create a new Robot Robot Dalek = new Robot(); // 5. Set your robot's pen to the down position Dalek.penDown(); // 3. Set the robot to go at max speed (10) Dalek.setSpeed(20); // 4. Do the following (steps 5-8) 75 times for (int i = 0; i < 150; i++) { // 7. Change the pen color to random Dalek.setRandomPenColor(); // 6. Move the robot 5 times the current line number you are drawing (5*i) Dalek.move(5 * i); // 2. Turn the robot 1/3 of 360 degrees to the right Dalek.turn(150); // 8. Change the number of sides to 7 (don’t add a new line of code for this one!) // 9. Set the pen width to i Dalek.setPenWidth(i); } }