- About
- Features
- Usage
- File Structure
- Community
- Guideline
- Resources
- Gallery
- Credit/Acknowledgment
- License
- Hall Of Fame
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.
- 2 player interactive game
- Supports undo operation
- Supports interactive game sounds
- Ability to play with computer AI (in development phase)
- Multiplayer on local network using sockets (in development phase)
- Ability to customize game theme (in development phase)
- Cross platform Linux, Windows, Mac (in development phase)
To use this project.
- Install dependencies & export environment variables.
$ sudo -H pip3 install -r requirements.txt
- Start project using
$ python3 game.py
- Add a file structure here with the basic details about files, below is current file structure.
.
├── assets.py
├── CODE_OF_CONDUCT.md
├── config.py
├── _config.yml
├── connect_game.py
├── events.py
├── game_board.py
├── game_data.py
├── game.py
├── game_renderer.py
├── images
│ ├── blackball91px.png
│ ├── game.svg
│ ├── logo
│ │ ├── c4.gif
│ │ ├── connect4.gif
│ │ └── 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, 26 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. |
16. | CODE_OF_CONDUCT.md | tells about our responsibilities as a team |
- Dependency Graph
- Code Style
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.
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 ?
Your contributions are always welcome and appreciated. Following are the things you can do to contribute to this project.
-
Report a bug
If you think you have encountered a new issue, and I should know about it, feel free to report it here and I will take care of it. -
Create a pull request
It can't get better then this, your pull request will be appreciated by the community. You can get started by picking up any open issues from here and make a pull request.
If you are new to open-source, make sure to check read more about it here and learn more about creating a pull request here.
- No other permanent branches should be created in the main repository, you can create feature branches but they should get merged with the master.
- 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.
Start Game Window
Game Play
Game Play GIF
Restart or Quit as the Game ends.