The game
The course provided the display, touchscreen and SDRAM drivers. I wrote the game on top: board and ship models, placement with rotation and collision checks, the turn loop, a touch UI with on-screen buttons, and hit and miss animations. Players place three ships (4, 3 and 2 tiles) on a 7 × 7 grid. In two-player mode the attacker sees the opponent's board with unhit ships hidden and can flip to their own board.
The AI
The single-player opponent hunts with the STM32's hardware random number generator. Once it lands a hit, it switches to a kill mode that probes the four tiles around the last hit until the ship sinks, then goes back to hunting.
Using the hardware
The scoreboard is a heatmap. At the end of every game, each tile's hits are added to a running total that I erase and reprogram into the last sector of internal flash, so the data survives power cycles. The scoreboard screen draws the whole board as a color gradient of where ships get hit most.
Holding the blue user button for more than three seconds resets to the main menu from anywhere. A rising/falling-edge EXTI interrupt starts and stops TIM6, which counts whole seconds while the button is held. A quick tap does nothing, so the game can't be reset by accident.