this is an LED Light Display Game I developed inspired by Ricker Dining Hall's Death By chocolate Thursdays at Stanford University. the user uses a joystick to move a player object represented by a square around an 8 by 8 led display and eat cakes (which are at each corner). Every time the player object eats a cake, the player object will move back to the center of the display. However, one of the four cakes are randomly set to be poisonous (you won't know which one), and if you eat one of those cakes the game will reset. The goal of the game is for the user to eat as many cakes as possible without “dying.”
General Idea
The key to the led lights will be to have nmos transistors setup across each of the rows, while having the main line connecting those transistors connected to a 5v source. each column will be connected to a current limiting resistor followed by a input signal. the combination of the input signals will determine which led lights will be on and which will be off.


Soldering components of the LED board


Key components of the code

I declared variables for the joystick pins. These include the s-pin which senses whether the joystick is being pressed down, a pin sensing x-direction movement, and a pin sensing y-direction movement.
the player object position is represented by a 2x2 square on the led display, and so I declared an x-position and a y-position for each of those led lights.
each row can be activated using the anode pins and each column can be activated using the cathode pins, as shown in the lists. to turn an led on, you would set the anode pin to high and the cathode pin to low.
the display game screen function creates and displays the current state of the game, whether it be at the start screen or while the user is playing. when the game is on, this function is called continuously in the main loop.
*Notice that there is a display helper function that is called in the main function that takes in the grid pattern as a parameter and displays that on the screen.


this code is included in the main loop and reads the state of the toggle switch in order to update the position of the player object.
this code checks to see if the cake was eaten, and resets the position of the player object if it was.

Final design


WHAT I LEARNED
USING A MULTIMETER OF SOME SORT, ALWAYS ensure TO CHECK IF YOUR COMPONENTS ARE WORKING WHILE YOU ARE SOLDERING THEM IN, ESPECIALLY IF YOU HAVE A LOT TO SOLDER. THIS WAS ESPECIALLY THE CASE WHEN I WAS SOLDERING IN THE 64 LED BULBS.
when developing a game involving an led display, you have to balance reaction delay with the relative brightness of the display in the code.
You always have to draw out the various edge cases involved in grid pattern algorithms, as you have to ensure that the object does not move out of the frame in these instances. This is especially important when using the pygame module in python or in 2d unity simulations/games.
A Note from Umar
I avoid simply placing my computer science projects on GitHub. I personally believe that GitHub doesn't do as well of a job as showcasing the process of constructing a computer science project as a portfolio would. Therefore, I aim to display all my personal and internship projects on this site, showing not only my code but also my thought process in constructing the program.