This repository contains the code for a Connect Four game built using React for the frontend, Flask for the backend, and Python for the AI logic.
- Two gameplay modes: Two-player mode and Play with AI mode.
- Intuitive UI with a board for gameplay and options for starting, restarting, and exiting the game.
- React
- Vite (for fast development)
- Tailwind CSS (for styling)
- HTML
- Flask (Python web framework)
- Python (for AI logic)
- Node.js and npm (for running the frontend)
- Python (for running the backend and AI logic)
- Clone the repository:
git clone https://github.com/yourusername/connect-four.git
- Navigate to the frontend directory:
cd connect-four/frontend
- Install dependencies:
npm install
- Run the frontend:
npm run dev
- Access the application in your browser at
http://localhost:3000
.
- Navigate to the backend directory:
cd ../backend
- Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # for Unix/Linux
- Install Flask and required dependencies:
pip install -r requirements.txt
- Run the Flask server:
python app.py
This will start the Flask server for the backend.
The AI logic is implemented in Python. The Flask backend provides an API endpoint /get_ai_move
that serves AI moves during the game.
Update the setupProxy.jsx
in the frontend to specify the correct backend URL if the Flask server runs on a different port or domain.
Developed by Protyay Dey. Inspired by the classic game of Connect 4.