Processing other codes
Now that we have implemented a method that allows the player to be killed, we can handle the final outstanding pre-defined code value—DEAD
. This code makes entering the marked square lethal to the player. We will implement this code by building a helper method that will examine the current cell's code value and take appropriate action.
If you define additional code values, you can expand on this method to react to them appropriately.