Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import turtles.*;
- ////////My turtle library uses a modified sprite which is the character from the Touhou game series, Marisa Kirisame. Just to clear up some possible confusion later--------------------------
- ////////Select and uncomment each section of code (ctrl+/) one at a time to test each script--------------------------------------------------------------------------------------------------
- public class Testing extends TurtleProgram {
- public void run() {
- this.setSize(1600, 900);
- ////start code1 ////// 9/15/10 First test of while statements----------------------------------------------------------------------------------------------------------
- // int var;
- // int rav;
- // rav = 50;
- // var = 0;
- // while(var < 3) {
- // Turtle eltrey;
- // eltrey = new Turtle(200, rav);
- // eltrey.forward(100);
- // eltrey.hide();
- // var = var + 1;
- // rav = rav + 50;
- // }
- // }
- //}
- ////end code1
- ////start code2 ////// 9/15/10 First test of readInt command-----------------------------------------------------------------------------------------------------------
- // Turtle eltrey; //hurr
- // eltrey = new Turtle(50, 50); //durr
- // int degrees = this.readInt(); //--//Input number of degrees to turn in all
- // int dPerIt = this.readInt(); //--//Input number of degrees to turn per iteration
- // int pPerIt = this.readInt(); //--//Input number of pixels to move per iteration
- // degrees = degrees / dPerIt; //compensates for the degree change due to 'right(dPerIt)'
- // int amt = 0; //sets initial amount of iterations
- // while (amt < degrees) { //start while loop to repeat following lines until 'degrees' if fulfilled
- // eltrey.forward(pPerIt); //moves eltrey 'pPerIt' pixels
- // eltrey.right(dPerIt); //turns eltrey 'dPerIt' degrees
- // amt = amt + 1; //changes amount of iterations
- // }
- //// eltrey.forward(50); //following lines create 100px line tangent to the created semi/circle
- //// eltrey.right(180); //commented out by default because it is boring
- //// eltrey.forward(100);
- //
- // }
- //}
- ////end code2
- ////start code3 //////// 9/15/10 Creates a semicircle using two turtle objects and creates a tangent line 100px long.--------------------------------------------------
- // Turtle eltrey; //hurr
- // eltrey = new Turtle(50, 50); //durr
- // Turtle yertle; //initialises a second turtle
- // yertle = new Turtle(50, 165); //places the second turtle
- // int degrees = 90; //each turtle makes a quarter of a circle
- // int amt = 0; //sets initial amount of iterations
- // while (amt < degrees) { //start while loop to repeat following lines until 'degrees' if fulfilled
- // eltrey.forward(5); //moves eltrey '5' pixels
- // eltrey.right(5); //turns eltrey '5' degrees
- // yertle.forward(5); //moves yertle '5' pixels
- // yertle.left(5); //turns yertle '5' degrees
- // amt = amt + 5; //changes amount of iterations
- // }
- // eltrey.forward(50); //following lines create 100px line tangent to the created semi/circle
- // yertle.forward(50);
- //
- // }
- //}
- ////end code3
- ////start code4 //////// 9/16/10 Input the number of sides you want on the N-Gon that is to be generated by the script.------------------------------------------------------
- // Turtle marisa; //Makes turtle named Marisa
- // marisa = new Turtle (500, 500); // (named after the character sprite used)
- // int sides = this.readInt(); //--//Input number of sides for the N-Gon to have
- // int reps = 0; //Sets variable 'reps' which is the amount of repetitions of the while statemen completed.
- // double deg = 360 / sides; //Calculates number of degrees for Marisa to turn to initiate each side (from
- // while(reps < sides -1) { //Start of the loop to creat the main meat of the output, the N-Gon. As for the -1, see after this while statement.
- // marisa.forward(1200 / sides); //Draws the side, the '/ sides' just ensures that in case you want a 100-Gon it doesn't draw to infinity and beyond
- // marisa.left(deg); //Turns the appropriate angle to create the next edge
- // reps = reps + 1; //Acts as a counter for the while statement, simply to end the loop at the appropriate time, no matter what 'sides' is.
- // }
- // marisa.forward(1200 / sides); //Utilises the -1 just so that the animation doesn't end with her doing a fruitless turn. It just annoys me for
- // marisa.hide(); // no real reason. Instead of the while statement completing the last line and turning, it goes to this and
- // } // draws the last line.
- //}
- ////end code4
- //start code5
Advertisement
Add Comment
Please, Sign In to add comment