For our reaction challenge game we decided to do 1D pong. I thought this was a good idea because I really like the simplicity of pong and this is a fun way to recreate the game.
The game starts out in a sort of home position, with the middle LED staying on, as soon as one of the buttons is pushed, the LEDs light up in a line going away from the button, the other person must then push their button while the one before last LED is lit up. If the last LED lights up, it counts as a win for the other side. And with each consecutive hit back and forth, the blinking of the lights gets faster. The hardest part of this was trying to figure out what code needed to go where. I struggled with knowing what needed to happen, and I thought I knew how to make it happen, but I wasn’t confident in where everything needed to go. I had also originally made an 11 state machine with a state for each LED lighting up, but then figured out that I could just use a state for going one way and another for going the other way.
Below is a drawing of our state machine. We determined we had 5 states for this game: home, moving to B, moving to A, player 1 score, and player 2 score.
We got a decent amount of the way, but then we hit a road block. After struggling for a while, Witt managed to talk to Dr. Hamid in his office hours and get a little guidance. After that, it was almost working but still not quite there. So I went through and reformatted a little bit (it was mainly just moving some brackets around) and everything worked! Then I just changed it real fast so the lights would get faster with each button press and we had our game. Witt and I both did some of each, but he did most of the hardware, while I tried to nail down the software in an attempt to get everything done faster.
Here is our game functioning.