diff --git a/.gitignore b/.gitignore index 78ea2e74..2ee69328 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ *.class *.class + +*.class + +*.class diff --git a/src/solutions/PentagonCrazySolution.java b/src/solutions/PentagonCrazySolution.java index c3d81b5d..2821aee1 100755 --- a/src/solutions/PentagonCrazySolution.java +++ b/src/solutions/PentagonCrazySolution.java @@ -1,5 +1,7 @@ package solutions; +import java.awt.Color; + import org.jointheleague.graphical.robot.Robot; /* Teacher’s note: before beginning, draw a pentagon and have students work out the angle that the robot will have to turn (360/5) */ @@ -14,7 +16,7 @@ private void makePrettyThings() { // 8. make the robot go at maximum speed robot.setSpeed(10); // 9. choose a color that you like for the shape - robot.setPenColor(30, 130, 30); + robot.setPenColor(Color.GREEN); // 4. make a variable for the number of sides you want (can’t test this one) int sides = 5; // 5. make a variable for the angle you want the robot to turn. Hint: you can divide in Java using “/”. Can’t test until step 6. diff --git a/src/solutions/DavesSpiralSolution.java b/src/solutions/SpiralSolution.java similarity index 66% rename from src/solutions/DavesSpiralSolution.java rename to src/solutions/SpiralSolution.java index d33aa806..85a83bb1 100755 --- a/src/solutions/DavesSpiralSolution.java +++ b/src/solutions/SpiralSolution.java @@ -1,29 +1,27 @@ package solutions; -import java.util.Random; - import org.jointheleague.graphical.robot.Robot; -public class DavesSpiralSolution { +public class SpiralSolution { public static void main(String[] args) { // 1. Create a new Robot and set its pen to the down position - Robot rob = new Robot(); - rob.penDown(); + Robot robot = new Robot(); + robot.penDown(); // 3. Set the robot to go as fast as possible - rob.setSpeed(10); + robot.setSpeed(10); // 4. Do the following (steps 5-8) 75 times for(int i = 0; i < 75; i++) { // 6. Change the pen color to random - rob.setPenColor(new Random().nextInt(255), new Random().nextInt(255), new Random().nextInt(255)); + robot.setRandomPenColor(); // 5. Move the robot 5 times the current line number you are drawing (5*i) - rob.move(5*i); + robot.move(5*i); // 2. Turn the robot 1/3 of 360 degrees to the right //rob.turn(360 / 3); // 7. Change the number of sides to 7 (don’t add a new line of code for this one!) - rob.turn(360 / 7); + robot.turn(360 / 7); // 8. Set the pen width to i - rob.setPenWidth(i); + robot.setPenWidth(i); } } } \ No newline at end of file