With this project, I wanted to further explore Java graphics and user-interactive game development. I did some research and came across the concept of a Simon Says game. I immediately thought it would be a great project to build on those skills while making something fun and engaging.
I’ve designed four classes: Simon, ColorPad, ScoreBoard, and Pattern.
Simon is the managing class, it dictates the game flow and graphics while responding to the user’s interactions. Simon initializes the pads with instances of the ColorPad class. Creating the pads as objects allows the number of pads displayed in the game very flexible. Displaying new pads is just a matter of creating a new object and giving it a color and a size.
While I initially had ScoreBoard and Pattern as part of the Simon class, I decided declaring two additional classes for them is the better design choice. The reasoning behind my decision was that creating random patterns and making score calculations within the Simon class hurts its cohesion. Since the calculations of the scores and patterns are not part of the game’s control-flow, doing these calculations on separate classes keeps the focus of the Simon class on game-flow and graphics.