Skip to content

Commit ad457c7

Browse files
committed
- reorder if-else statements
1 parent 7cb6017 commit ad457c7

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

chapter-05-iteration_and_randomness/truchet_tiles_variations/quarter_circle_tiles_in_duotone/quarter_circle_tiles_in_duotone.pyde

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,21 @@ row = 0
1010
for i in range(1, 145):
1111
noStroke()
1212
fill('#FFFFFF')
13-
14-
if (i + row/50) % 2:
15-
16-
if int(random(2)):
17-
square(col, row, 50)
18-
fill('#004477')
13+
odd = (i + row/50) % 2
14+
15+
if int(random(2)):
16+
square(col, row, 50)
17+
fill('#004477')
18+
19+
if odd:
1920
arc(col+50, row, 50, 50, PI/2, PI)
2021
arc(col, row+50, 50, 50, PI*1.5, 2*PI)
2122
else:
2223
arc(col, row, 50, 50, 0, PI/2)
2324
arc(col+50, row+50, 50, 50, PI, PI*1.5)
24-
25+
2526
else:
26-
if int(random(2)):
27-
square(col, row, 50)
28-
fill('#004477')
27+
if odd:
2928
arc(col, row, 50, 50, 0, PI/2)
3029
arc(col+50, row+50, 50, 50, PI, PI*1.5)
3130
else:

0 commit comments

Comments
 (0)