Summary
The Snake game is taking shape. We now have an apple that spawns ready to be eaten, although we have nothing to eat it yet. We have also learned about the ArrayList
class and how to use it with the enhanced for
loop, and we have also seen the Java enum
keyword and how it is useful for defining a range of values along with a new type. We have also seen approximately how we will use an enum
to keep track of which direction the snake is currently moving.
In the next chapter, we will code the Snake
class, including using an ArrayList
instance and an enumeration, to finish the Snake game.