Design and Testing

PiSimon is our game app based on the popular memory game "Simon." PiSimon consists of four colored tiles that are first “lit up” in a specific sequence before the user is then prompted to repeat the sequence by pressing the tiles in the correct order. The game launches with a “main” screen, where the user may press to begin the game. As long as the user is able to successfully repeat the given pattern, they will advance to the next level of the game. However, if an incorrect guess is entered, the game ends and the user must restart from the first level to continue play. The design and testing aspects of PiSimon are discussed below.

Design steps for this app consisted of using the appropriate PyGame functions to display the desired patterns on the piTFT screen, implementing and optimizing the touch input detection on the various color tiles, and performing all necessary actions required to both generate random sequences as well as record and assess the correctness of the user-entered pattern. PiSimon's design exhibits modularity by having separate, contained functions for animating the pattern, controlling the game state, and checking any registered touch inputs to the screen. We relied heavily on the rectangle-drawing capabilities of PyGame, and we "lit up" the tiles by displaying a white bounding box on a given tile for a short period of time, using a Python time libary function. As the level increases, the length of the pattern increases while the period of the "lighting up" of tiles decreases.

A dedicated function was implemented to handle all control state aspects of PiSimon, using maintained variables for the current level, current game pattern, and user-entered pattern. This control function will check the correctness of the user-entered pattern once all inputs are received before performing the necessary action to either end the game or generate the next level of play. For touch input detection, we implemented a dedicated function to check any press that occurs while in the user-entry mode of the PiSimon app, as well as the detection of the start of the game based on the appropriate main menu button. In terms of registering the initial detection of a full touch screen press, we use the Pygame event detect functions that return the position of a touch press, which we then pass in to our check function.

Figure 1: Desktop testing of PiSimon

Testing for PiCalc consisted of user testing to verify the touch detection accuracy as well as the correct game behavior. First, all touch detection needed to be confirmed to be working as expected. This was done by temporarily setting the appropriate environment variables in order to run the app in a console on the startx Pi desktop, which allowed for precise clicks with the mouse to be observed in order to confirm functionality. An image from this process can be found in Figure 1 . We also performed extensive user testing to confirm the game state was being properly updated on each complete user entry. We then proceeded to repeat all testing on the piTFT screen, which is where the PiSimon app will ultimately be run.


Results

The resulting PiSimon app is able to properly perform all game-related control and event detection in order to provide a fun, simple memory game that the user can play on his or her PiWatch. Figures 2-5 depict a few instances of the PiSimon app running on the piTFT setup.

Figure 2: PiSimon Operation Example

Figure 3: PiSimon Operation Example

Figure 4: PiSimon Operation Example

Figure 5: PiSimon Operation Example