Modeling block shape

The approach used to modeling shape varies depending on numerous variables, such as the kind of shape that must be measured and in what spacial dimension the shape is to be modeled. Modeling three-dimensional shapes—all things being equal—is more difficult than modeling two-dimensional shapes. Lucky for us, tetrominoes are two-dimensional in nature. Before we start modeling our shapes programmatically, it is important we know the exact shapes we are attempting to model. There are seven fundamental tetromino pieces that exist in Tetris. These pieces are the O, I, T, L, J, S and Z tetrominos. The following image shows the fundamental tetromino shapes that exist in Tetris:

All preceding shapes take up space within the confines ...

Get Kotlin Programming By Example 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.