Skip to content

A Python-based console implementation of the classic Connect Four game using object-oriented programming. Supports two-player gameplay with real-time win detection (horizontal, vertical, and diagonal) on a 6Γ—7 grid.

Notifications You must be signed in to change notification settings

khadibd/Connect-Four-Console-Game-Python-OOP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Connect Four Game in Python

This is a simple Connect Four game implemented in Python using object-oriented programming. The game allows two players to take turns and place their tokens (X or O) in a 6x7 grid. The first player to connect four tokens horizontally, vertically, or diagonally wins!

Features

  • 6x7 game board displayed in the console.

  • Two-player mode (no AI, human vs human).

  • Input validation for column selection.

  • Automatic checking for winning conditions in all directions.

How to Run

  1. Clone this repository:
git clone https://github.com/khadibd/Connect-Four-Console-Game-Python-OOP
  1. Navigate to the folder:
cd ConnectFourGame
  1. Run the game:
python connect_game.py
  1. Follow the prompts to enter the column number for your move. Example
Player X give the column to play: 3
[['-', '-', '-', '-', '-', '-', '-'],
 ['-', '-', '-', '-', '-', '-', '-'],
 ['-', '-', '-', '-', '-', '-', '-'],
 ['-', '-', '-', '-', '-', '-', '-'],
 ['-', '-', '-', 'X', '-', '-', '-'],
 ['-', '-', '-', '-', '-', '-', '-']]

πŸ‘©β€πŸ’» Author

Eng. Khadija Bouadi

πŸ“§ Contact

For any queries, reach out to:

GitHub: @khadibd

Email: khadibd00@gmail.com

About

A Python-based console implementation of the classic Connect Four game using object-oriented programming. Supports two-player gameplay with real-time win detection (horizontal, vertical, and diagonal) on a 6Γ—7 grid.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages