In the current version of the game, when you hit a rock with a bullet, the rock disappears, which is not very realistic. In this lesson, we will modify the Rock constructor to handle the splitting of rocks. We will also introduce different rock sizes.
Let’s start by creating a factory method within the Rock class. This method, called .create_random(), will be responsible for constructing and returning a rock object. This approach makes the code clearer and easier to read.