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 O’Reilly online learning.

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