The rooms we built with the buildRoom() function in Chapter 12 are useful, but they won’t keep the rain out. In this chapter, we’ll write a buildFloor() function to build floors and ceilings, and we’ll also write a buildfloor program to call that function. We’ll use one function to build floors and ceilings because a ceiling is just a floor built higher up, as shown in Figure 13-1.

The algorithm we’ll use to build floors will move a turtle across a rectangular area and make the turtle perform an action at every space. In this chapter, the turtle will place a block at every space in the rectangular area, but this flexible ...

Get Coding with Minecraft now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.