19.04.2017 Views

Learn to Program with Small Basic

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using triangle <strong>with</strong><br />

repeatCount = 12<br />

Using square <strong>with</strong><br />

repeatCount = 10<br />

Using pentagon <strong>with</strong><br />

repeatCount = 10<br />

Using hexagon <strong>with</strong><br />

repeatCount = 6<br />

Using hexagon <strong>with</strong><br />

repeatCount = 8<br />

Using octagon <strong>with</strong><br />

repeatCount = 8<br />

Figure 5-19: Some of the patterns you can create by experimenting <strong>with</strong> PolygonArt.sb<br />

Experiment <strong>with</strong> this program <strong>to</strong> see what other shapes you can discover!<br />

TRY IT OUT 5-5<br />

Change Listing 5-11 <strong>to</strong> draw three polygons (instead of two) of different sizes, and<br />

then rotate them. Save your discoveries for your next art gallery. (Or, if you don’t<br />

want <strong>to</strong> become a millionaire, go <strong>to</strong> http://tiny.cc/turtlepatterns/ and share them<br />

<strong>with</strong> the world!)<br />

<strong>Program</strong>ming Challenges<br />

If you get stuck, check out http://nostarch.com/smallbasic/ for the solutions<br />

and for more resources and review questions for teachers and students.<br />

1. This code draws a circle:<br />

For K = 1 To 36<br />

Turtle.Move(6)<br />

Turtle.Turn(10)<br />

EndFor<br />

70 Chapter 5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!