Connect Four Game
Project Overview
The Connect Four Game is a web-based two-player strategy game where players alternately drop colored discs into a vertical grid. The goal is to form a line of four discs in a row — horizontally, vertically, or diagonally. The system can support local play, AI-based single-player mode, or real-time multiplayer mode over the internet. This project demonstrates game logic implementation, UI design, and backend state management.
Key Features
-
User Authentication (Optional)
-
Players can register/login to track wins and losses.
-
Guest mode for instant play without registration.
-
-
Game Modes
-
Local Two-Player Mode: Two players play on the same device.
-
Single-Player Mode (AI): Play against computer with difficulty levels.
-
Multiplayer Mode: Real-time play with friends or random opponents using WebSockets.
-
-
Game Board
-
7x6 vertical grid where discs are dropped into columns.
-
Interactive animations for disc dropping.
-
Color-coded discs (e.g., red vs yellow).
-
-
Win & Draw Detection
-
Automatic detection of four consecutive discs (row, column, diagonal).
-
Draw detection when the board is full with no winner.
-
-
Leaderboard & Player Stats
-
Stores wins, losses, and draws.
-
Global leaderboard for competitive play.
-
-
Responsive UI
-
Mobile-friendly design using Bootstrap.
-
Smooth animations for disc drops and winning sequences.
-
Technology Stack
-
Frontend: HTML, CSS, Bootstrap, JavaScript (animations and board logic).
-
Backend:
-
Node.js (Socket.io): Real-time multiplayer support.
-
Or PHP/Java: Session-based game management.
-
-
Database: MySQL / MongoDB (for user accounts, leaderboard, and game history).
-
AI Algorithm (Optional):
-
Minimax algorithm with Alpha-Beta pruning for computer opponent.
-
How It Works
-
Player logs in or selects guest mode.
-
Chooses game mode: Local, AI, or Online Multiplayer.
-
In each turn, a player selects a column → disc falls to the lowest available cell.
-
Backend/game logic checks for:
-
Win Condition: 4 consecutive discs.
-
Draw Condition: Full board with no winner.
-
-
Game result displayed → leaderboard updates if applicable.