Skip to content

Satvinder31415/connect4-2

Repository files navigation

Open Issues Forks Stars Maintained Made with Python Open Source Love Built with Love Follow Me Slack

📒 Index

🔰 About

Connect Four is a two-player connection game in which the players first choose a color and then take turns dropping one colored disc from the top into a seven-column, six-row vertically suspended grid. The pieces fall straight down, occupying the lowest 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.

⚡ Usage

To use this project.

🔌 Installation

  • Install dependencies & export environment variables.
$ sudo -H pip3 install -r requirements.txt

📦 Commands

  • Start project using
$ python3 game.py

📁 File Structure

  • Add a file structure here with the basic details about files, below is current file structure.
.
├── assets.py
├── config.py
├── connect_game.py
├── events.py
├── game_board.py
├── game_data.py
├── game_renderer.py
├── game.py
├── images
│   ├── blackball91px.png
│   ├── logo
│   │   └── connect4.png
│   ├── redball90px.png
│   ├── screenshots
│   │   ├── 1.png
│   │   └── 2.gif
│   └── yellowball90px.png
├── LICENSE
├── README.md
├── requirements.txt
├── restart.sh
└── sounds
    ├── disc_drop_1.wav
    ├── disc_drop_2.wav
    └── event.ogg

4 directories, 21 files

No File Name Details
1 assets.py used for loading sound and image files in python.
2 config.py contains game's configuration settings.
3 connect_game.py Contains the ConnectGame class which holds the logic for the whole game.
4 events.py Contains classes used to define and hold event data.
5 game_board.py Contains the GameBoard data structure and methods which operate on it.
6 game_data.py Contains the GameData class, which contains all of the data in the game.
7 game_renderer.py Holds the GameRenderer class, which renders the game state using sound and graphics.
8 game.py contains connect four game logic.
9 images/ contains image resources used in the game.
10 images/logo contains logo used in the README.
11 images/screenshots contains game screenshots.
12 LICENSE this project uses MIT License.
13 requirements.txt contains all the dependencies used in the game.
14 restart.sh bash script to relaunch the game once it is finished.
15 sounds/ contains sound resources used in the game.
  • Dependency Graph

❗ Guideline

  • Code Style

black

In order to maintain the code style consistency across entire project I use a code formatter. I kindly suggest you to do the same whenever you push commits to this project.

The python code formatter I chose is called Black. It is a great tool and it can be installed quickly by running

sudo -H pip3 install black

or

python3.6 -m pip install black

It requires Python 3.6.0+ to run.

  • Usage
black {source_file_or_directory}

For more details and available options, please check their psf/black.

isort

I also use isort, it is a Python utility / library to sort imports alphabetically, and automatically separated into sections. It provides a command line utility which can be installed using.

sudo -H pip3 install isort 
  • Usage
isort {source_file}.py

For more details and available options, please check their timothycrosley/isort.

  • Close Issues

Close issues using keywords: how to ?

📄 Resources

  • PyGame Documentation : Pygame is a cross-platform set of Python modules designed for writing video games. It includes computer graphics and sound libraries designed to be used with the Python programming language.

📷 Gallery

🌟 Credit/Acknowledgment

Contributors

🔒 License

License

About

This version of connect4 forked from connect4 (by codemonk) includes a menu screen.Pressing enter will launch the game.After the game is over,pressing y will restart while n will quit the game.Feel free to modify the code and add graphics(currently there are none). Also, bear in mind that this version is 2 commits behind the original one.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages