Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. public void start5_A1(){
  2. joe.setPenColor(Color.red);
  3. boolean richtung = true;
  4. for(int i=0; i<30; i++){
  5. if(richtung == true){
  6. joe.forward(10);
  7. joe.right(90);
  8. richtung = false;
  9.  
  10. if(i > 15){
  11. joe.setPenColor(Color.green);
  12. }
  13. } else {
  14. joe.forward(10);
  15. joe.left(90);
  16. richtung = true;
  17. }
  18. }
  19. joe.setPenColor(Color.blue);
  20. }
  21.  
  22. public void start6_A2(){
  23. resetJoe();
  24.  
  25. int i = 0;
  26. while(i<6){
  27. joe.forward(100);
  28. joe.right(120);
  29. joe.forward(100);
  30. joe.right(120);
  31. joe.forward(100);
  32. joe.right(60);
  33. i++;
  34. }
  35.  
  36. joe.penUp();
  37.  
  38. for(int a=0;a<6;a++){
  39. if(a%2==0){
  40. joe.setFillColor(Color.red);
  41. } else if (a%2==1){
  42. joe.setFillColor(Color.green);
  43. }
  44. joe.right(30);
  45. joe.forward(50);
  46. joe.fill();
  47. joe.right(180);
  48. joe.forward(50);
  49. joe.right(90);
  50. }
  51.  
  52. }
  53.  
  54. public void start7_A3(){
  55. Color red = new Color(255,105,180);
  56. Color green = new Color(0,255,0);
  57. joe.hideTurtle();
  58.  
  59. for(int i=0;i<500;i=i){
  60.  
  61. int zufall = (int)(Math.random()*50);
  62.  
  63. if (zufall > 40){
  64. joe.setPenColor(Color.red);
  65. } else{
  66. joe.setPenColor(Color.green);
  67.  
  68. }
  69. joe.forward(zufall);
  70. int i_f = (int)(Math.random()*10);
  71.  
  72. if(i_f < 5){
  73. joe.left(90);
  74. }else{
  75. joe.right(90);
  76. }
  77.  
  78. i++;
  79. }
  80.  
  81. joe.showTurtle();
  82. }
  83.  
  84. public void start8_A4(){
  85. Color red = new Color(255,105,180);
  86. Color green = new Color(0,255,0);
  87. joe.hideTurtle();
  88. int distance= 0;
  89. joe.distance(0,0);
  90. for(int i=0;i<500;i=i){
  91.  
  92. int zufall = (int)(Math.random()*50);
  93. System.out.println(joe.distance(0,0));
  94. if (joe.distance(0,0) > 40){
  95. joe.setPenColor(Color.red);
  96. }else if (joe.distance(0,0)< 40){
  97.  
  98. joe.setPenColor(Color.green);
  99. }else{
  100. joe.setPenColor(Color.red);
  101.  
  102. }
  103. joe.forward(zufall);
  104. int i_f = (int)(Math.random()*10);
  105.  
  106. if(i_f < 5){
  107. joe.left(90);
  108.  
  109. }else{
  110. joe.right(90);
  111.  
  112. }
  113.  
  114. i++;
  115. }
  116.  
  117. joe.showTurtle();
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement