12CONSTRUCTING ROOMS

image

When you put together four walls, you have a room! In this chapter, you’ll create the buildRoom() function, which calls buildWall() four times to construct a room like the one shown in Figure 12-1. This chapter is short and sweet because you did most of the coding work when you wrote the buildWall() function in Chapter 11. When you’re done creating the buildRoom() function, you’ll be able to use it to build complex structures, such as a castle!

image

Figure 12-1: A 5 × 6 × 4 room built of stone bricks

DESIGNING A ROOM-BUILDING ALGORITHM ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.