Connect Four is a two-player strategy game in which the players take turns dropping colored discs into a vertical grid. The objective of the game is to connect four of one's own discs of the same color vertically, horizontally, or diagonally before your opponent does.
In one of my previous videos I described a way to make such a game on a TFT touch screen. This time I will explain to you how to make a Connect4 game on an 8 x 8 pixel matrix with 5050 type LEDs with a built-in WS2812B chip.

Also now we have two game modes, player vs player and player vs microcontroller. You can find the original code at AZdelivery :
, and then this code was reworked by Mr. Küster adding the ability to play against a microcontroller. I also added simple sounds with help of "NewTone" library , so the game now is even more interesting.

Otherwise, the device is very simple to build and contains several components:
- Arduino Nano microcontroller
- 8x8 RGB matrix with WS2812 led chips
- Three buttons,
- and Buzzer
Also for the led matrix I made a dedicated grid on a 3D Printer for a better visual impression. Tracing paper is placed on the grid for light diffusion, and then a protective transparent film.

Let's see how the game works in reality:
After starting the device, with the left button we select player vs player mode, while with the right button player vs microcontroller. In Player vs. Player, the starting color will be changed with each new game, and in Player vs. Microcontroller, the player always has red and begins the first game. After that, the loser always begins. First we will start a game player against the microcontroller, which is indicated by a continuous higher tone. Player is in red, and start first. At the end, if the microcontroller wins, display shows a smiling figure, and if Player win, then figure is sad.

The next mod is player vs player. This mode is indicated by a continuous lower tone. After one of the players wins, a line is indicated by three short flashes followed by a high-pitched sound, and then the entire screen lights up with the winner's color.

The device is built into a box from a my previous project , which is made of 3 and 5 mm PVC board, lined with self-adhesive colored wallpaper.
EXPANDED TECHNICAL DETAILS
Strategic AI Game Interaction
This project implements the classic "Connect 4" logic on a digital interface, featuring a "Smart" AI opponent that plays against the user.
- Minimax Game-Tree Implementation: The Arduino runs a simplified Minimax algorithm. For every turn, the firmware "Looks Ahead" 3-5 moves to evaluate which column provides the highest probability of a "Four-in-a-Row" victory.
- Interactive LED Gameboard: Uses an 8x8 LED Matrix or a custom 7x6 grid of NeoPixels. The Arduino manages the "Falling Animation" of the game pieces and indicates the winner with a flashing sequence.
Interaction
- Input Matrix Scanning: The user selects their move using a physical rotary encoder or a series of buttons, with the Arduino providing auditory cues for every turn.