Connect Four is a two-player connection game in which the players first choose a colour and then take turns dropping one coloured disc from the top into a seven-column, six-row vertically suspended grid. The pieces fall straight down, occupying the next available space within the column. The objective of the game is to be the first to form a horizontal, vertical, or diagonal line of four of one's own discs.
The board size can be adjusted by changing values of
board_height in program (default set to 4x6). Similarly, the PyGame window size can be adjusted by changing values of
window_height (default set to 640x480).
Also feel free to pass on remarks and suggestions to increase the quality of the code.
What things you need to run the program:
- Python Compiler (3.7 Recommended)
- Install PyGame from pypi by using the following commands:
pip install PyGame
How To Play
- If you have the correct version of Python and Pygame installed, you can run the program in the command prompt / terminal.
cd connect-4 python Connect4_Game.py
- Drag and drop coins at the column you want to make a move.
- Use the terminal window to view moments and other details.
Note: If you're using Python 3, replace the command "python" with "python3"