Connect 4

Connect 4 is a turn-based strategy game developed in Python as my first computer science project in college. Built using the pythonGraph graphics library, the game allows a player to compete against a computer-controlled opponent in a classic game of Connect 4. The interface features a 7-column, 6-row grid rendered in a colorful visual style, complete with a movable arrow that lets the player select where to drop their piece. The game begins with a simple start button and responds to keyboard input—arrow keys for moving the selection and the return key to confirm a move.

Each player takes turns dropping colored discs into the grid, with the goal of being the first to connect four pieces in a row vertically, horizontally, or diagonally. After the player’s turn, the computer opponent uses basic AI logic to either make a winning move or block the player from winning. If no strategic play is available, the computer defaults to a random legal move. Visual indicators display winning or losing states, and a “New Game” button allows the board to reset without restarting the program.

Connect 4 combines simple game mechanics with thoughtful implementation of AI and user interaction. It was my first experience with integrating gameplay logic, graphical rendering, and user input into a single application. This project not only introduced me to event-driven programming and game development but also sparked my interest in designing engaging interactive experiences through code.

If you want to see the GitHub repository click here.