Skip to content

A CLI Based Connect four strategic game build in python πŸ”—4️⃣

Notifications You must be signed in to change notification settings

SaadARazzaq/Connect4-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Connect 4 CLI Game Overview

Welcome to Connect 4, a classic two-player game now available in a Command Line Interface (CLI) version! In this game, you can choose to play against another player or challenge the computer. The objective is to connect four of your tokens in a row, either horizontally, vertically, or diagonally.

image

Features

  • Two-player mode
  • Player vs. Computer mode
  • Simple and intuitive CLI interface
  • Dynamic game board display

Requirements

  • Python 3.x
  • art library (for the welcome message)

Installation

  • Ensure you have Python 3.x installed on your system.
  • Install the art library using pip:
pip install art

How to Play

  1. Clone this repository or download the game script.
  2. Open your terminal or command prompt.
  3. Navigate to the directory where the script is located.
  4. Run the script using Python:
python Connect_4.py
  1. Follow the on-screen instructions to start the game.

Game Instructions

Main Menu

When you start the game, you will be presented with the main menu. You have the following options:

  1. Play a 2 player game
  2. Play a game against CPU (Computer)
  3. Exit

Playing the Game

  • Two Player Game: Each player takes turns to place their token on the board. Player 1 uses the "πŸ”΅" token and Player 2 uses the "πŸ”΄" token.
  • Player vs. CPU: You will play against the computer. You use the "πŸ”΅" token, and the computer uses the "πŸ”΄" token.

Making a Move

  • The game board is displayed with columns labeled A to G and rows numbered 0 to 5.
  • To make a move, input the column letter followed by the row number (e.g., A0).
  • The token will drop to the lowest available space in the selected column, adhering to gravity rules.

Winning the Game

  • The game ends when a player connects four of their tokens in a row, either horizontally, vertically, or diagonally.
  • The winner is announced, and the game board is displayed one final time.

Example Game Play

  1. Start the game and choose to play against the computer.
  2. Enter your player name.
  3. The game board is displayed, and the player's turn is indicated.
  4. Enter your move (e.g., "A0").
  5. The computer makes its move.
  6. The game continues until there is a winner or the board is full.

Game Screenshots:

image image image image image image image image image image image image

Test Cases:

image image

Developer Notes

  • The game uses a 6x7 grid to represent the Connect 4 board.
  • The art library is used to print the welcome message in a stylized font.
  • Functions are modular and handle specific tasks like printing the board, checking for a winner, and managing turns.

Future Enhancements

  • Add difficulty levels for the computer opponent.
  • Implement a graphical user interface (GUI) for a more interactive experience.
  • Allow players to undo moves.

Enjoy the game and have fun connecting four! πŸ’–

About

A CLI Based Connect four strategic game build in python πŸ”—4️⃣

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages