Skip to content

Daniel-Ope06/python-connect-four

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

184 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Connect Four Python Game

Python Pyglet Rich pytest

A Python implementation of the classic Connect Four game.

This project features two modes of play:

  1. A text-based Command Line Interface (CLI)
  2. A Graphical User Interface (GUI).

Gameplay Examples

Graphical User Interface (GUI)

Visual gameplay demonstration against the AI on Hard Mode.

GUI Gameplay GIF

Command Line Interface (CLI)

Text-based gameplay against the AI on Hard Mode.

CLI Gameplay GIF


Installation & Requirements

Ensure you have Python installed. This project relies on specific library versions to function correctly. A requirements.txt file is included to ensure compatibility.

To install all dependencies, run the following command in the project root directory:

pip install -r requirements.txt

How to Run

This project includes two entry points depending on how you wish to play the game.

1. Run the Command Line Interface (CLI)

To play the text-based version (using rich for formatting):

python run_cli.py

2. Run the Graphical User Interface (GUI)

To play the visual version (using pyglet):

python run_gui.py

Testing

The project uses pytest for unit testing. To execute the test suite:

python -m pytest

Project Structure

Item Description
cli/ Contains the core game logic and the text-based interface implementation.
gui/ Contains the code for the Graphical User Interface window and rendering.
tests/ Unit tests to ensure game logic validity.
replays/ Directory where game replay logs are stored.
docs/ Project documentation and README assets (screenshots/GIFs).
requirements.txt A list of all Python dependencies and versions required to run the project.
run_cli.py The entry point script to launch the CLI game.
run_gui.py The entry point script to launch the GUI game.

About

A dual-interface (CLI & GUI) Connect Four game built in Python, featuring a built-in AI opponent.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages