example.turtlelogo.Boxer.main(String[])   A
last analyzed

Complexity

Conditions 4

Size

Total Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
c 1
b 0
f 0
dl 0
loc 27
rs 9.232
1
package example.turtlelogo;
2
3
import org.gannacademy.cdf.turtlelogo.Turtle;
4
import org.gannacademy.cdf.turtlelogo.docs.SavableTerrarium;
5
6
public class Boxer {
7
    public static void main(String[] args) {
8
        SavableTerrarium terrarium = new SavableTerrarium();
9
        Turtle boxer = new Turtle(terrarium);
10
11
        boxer.rt(90);
12
        boxer.fd(10);
13
        boxer.rt(90);
14
        boxer.fd(10);
15
        boxer.rt(90);
16
        boxer.fd(10);
17
        boxer.rt(90);
18
        boxer.fd(10);
19
20
        terrarium.drawTo("square.png");
21
        terrarium.clear();
22
23
        for (int row = 1; row <= 10; row++) {
24
            for (int col = 1; col <= 10; col++) {
25
                boxer.teleport(row * 20, col * 20);
0 ignored issues
show
Bug introduced by
Math operands should be cast to prevent unwanted loss of precision when mixing types. Consider casting one of the operands of this multiplication to double.
Loading history...
26
                for (int side = 0; side < 4; side++) {
27
                    boxer.rt(90);
28
                    boxer.fd(10);
29
                }
30
            }
31
        }
32
33
        terrarium.drawTo("squares.png");
34
    }
35
}
36