This snippet was some of the most driving code within the Simon Says system. The randomized pattern generation to illuminate the LED’s was critical to operational success. Patterns could have been hard coded, but at the cost of efficiency and code readability.
Following the randomized pattern generation, this display function illustrates the initial step in reading user input. This “lock and key” mechanism (LED display and user input) ensures the advancement of progress throughout the game.