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.
- Two-player mode
- Player vs. Computer mode
- Simple and intuitive CLI interface
- Dynamic game board display
- Python 3.x
- art library (for the welcome message)
- Ensure you have Python 3.x installed on your system.
- Install the art library using pip:
pip install art
- Clone this repository or download the game script.
- Open your terminal or command prompt.
- Navigate to the directory where the script is located.
- Run the script using Python:
python Connect_4.py
- Follow the on-screen instructions to start the game.
When you start the game, you will be presented with the main menu. You have the following options:
- Play a 2 player game
- Play a game against CPU (Computer)
- Exit
- 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.
- 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.
- 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.
- Start the game and choose to play against the computer.
- Enter your player name.
- The game board is displayed, and the player's turn is indicated.
- Enter your move (e.g., "A0").
- The computer makes its move.
- The game continues until there is a winner or the board is full.
- 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.
- 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! π