| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package example.turtlelogo; |
||
| 7 | public class Test { |
||
| 8 | public static void main(String[] args) { |
||
| 9 | // headed east in center of screen |
||
| 10 | Turtle a = new Turtle(); |
||
| 11 | a.pc(Color.red); |
||
| 12 | |||
| 13 | // blue horizontal line in top-left screen, headed south |
||
| 14 | Turtle b = new Turtle(); |
||
| 15 | b.pc(Color.blue); |
||
| 16 | b.tp(10, 10); |
||
| 17 | b.hd(Turtle.EAST); |
||
| 18 | b.fd(100); |
||
| 19 | b.rt(90); |
||
| 20 | |||
| 21 | // green vertical zig zag on left screen, headed SE |
||
| 22 | Turtle c = new Turtle(); |
||
| 23 | c.pc(Color.green); |
||
| 24 | c.tp(10, 100); |
||
| 25 | c.hd(Turtle.SOUTH); |
||
| 26 | c.lt(45); |
||
| 27 | c.fd(20); |
||
| 28 | c.rt(90); |
||
| 29 | c.fd(20); |
||
| 30 | c.lt(90); |
||
| 31 | c.fd(20); |
||
| 32 | |||
| 33 | // orange circle on right screen, no turtle |
||
| 34 | Turtle d = new Turtle(); |
||
| 35 | d.ht(); |
||
| 36 | d.pc(Color.orange); |
||
| 37 | d.tp(500, 100); |
||
| 38 | for (int i = 0; i < 360; i++) { |
||
| 39 | d.fd(Math.PI * 2.0 * 25.0 / 360.0); |
||
| 40 | d.rt(1); |
||
| 41 | } |
||
| 42 | |||
| 43 | // fat purple box in bottom screen, turtle headed north |
||
| 44 | Turtle e = new Turtle(); |
||
| 45 | e.pc(new Color(200, 0, 180)); |
||
| 46 | e.pw(5); |
||
| 47 | e.tp(300, 300); |
||
| 48 | e.hd(Turtle.EAST); |
||
| 49 | e.fd(40); |
||
| 50 | e.rt(90); |
||
| 51 | e.fd(40); |
||
| 52 | e.rt(90); |
||
| 53 | e.fd(40); |
||
| 54 | e.rt(90); |
||
| 55 | e.fd(40); |
||
| 56 | |||
| 59 |