This is a computer game based on the 2-Player Connection Board Game 'Connect4', created using Python, Pygame and Pyautogui.
Firstly setup a Virtual Environment by following the below steps:
- Open Windows Powershell with Run as Administrator, and enter command
Set-ExecutionPolicy RemoteSigned
. - Then install virtualenv, by using command
pip install virtualenv
. - Go to the folder, where you want to create the folder for your website. (Let it be named as 'VirtualEnv' (You can choose any name!)).
- Open Windows Powershell in that folder and run command
virtualenv <folder_name>
(Let <folder_name> be 'venv_folder'). - Go inside the new folder created (venv_folder) by running command
cd <folder_name>
. - Then run command
./Scripts/activate
. This will allow you to enter a functional virtual environment. - Then download the zip file of the code, and extract the zip inside this folder (<folder_name>, here 'venv_folder').
Then run the below commands:
pip install -r requirements.txt
- After you run the above mentioned commands, run the
main.py
file. - A home-page window will open on the screen, where you can enter the names of Players (by default, ther are Player 1 (red color) and PLayer 2 (yellow color)).
- Once you enter the corresponding names (not mandatory to change the default names), you are all set to play the game.
- You can start the game by clicking on the
PLAY
button. - Now you will be presented with the main game-play region, a screen representing the 6x7 board of acutal board-game.
- Both the players can move as per the rules of the game as mentioned here: https://www.gamesver.com/the-rules-of-connect-4-according-to-m-bradley-hasbro/ .
- Now enjoy the game!
- pygame == 2.1.2
- numpy == 1.22.3
- pyautogui == 0.9.53
- Python==3.9.0
Home Page
Names Entered
Game Board
Winning Situation