[![Open Issues](https://img.shields.io/github/issues/code-monk08/connect-four?style=for-the-badge&logo=github)](https://github.com/code-monk08/connect-four/issues) [![Forks](https://img.shields.io/github/forks/code-monk08/connect-four?style=for-the-badge&logo=github)](https://github.com/code-monk08/connect-four/network/members) [![Stars](https://img.shields.io/github/stars/code-monk08/connect-four?style=for-the-badge&logo=reverbnation)](https://github.com/code-monk08/connect-four/stargazers) ![Maintained](https://img.shields.io/maintenance/yes/2019?style=for-the-badge&logo=github) ![Made with Python](https://img.shields.io/badge/Made%20with-Python-blueviolet?style=for-the-badge&logo=python) ![Open Source Love](https://img.shields.io/badge/Open%20Source-%E2%99%A5-red?style=for-the-badge&logo=open-source-initiative) ![Built with Love](https://img.shields.io/badge/Built%20With-%E2%99%A5-critical?style=for-the-badge&logo=ko-fi) [![Follow Me](https://img.shields.io/twitter/follow/codemonk08_?color=blue&label=Follow%20%40codemonk08_&logo=twitter&style=for-the-badge)](https://twitter.com/intent/follow?screen_name=codemonk08_) [![GitHub followers](https://img.shields.io/github/followers/code-monk08.svg?label=Follow&style=for-the-badge&logo=github)](https://github.com/code-monk08/) [![Slack](https://img.shields.io/badge/Slack-Chat-informational?style=for-the-badge&logo=slack)](https://join.slack.com/t/connectfourgroup/shared_invite/enQtODMxNTAwNDY4NDU0LTZmYTZkMzJiNWQwZDk1YjhlZTEzY2VhMDNkNjVhOGIzNGIyNmYxODM4NWI5MjNjYmJlZjk4MjA4MzQ3MjZhNDg)
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.
To use this project.
$ sudo -H pip3 install -r requirements.txt
$ python3 game.py
.
├── 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 |
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.
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
isort {source_file}.py
For more details and available options, please check their timothycrosley/isort.
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.
Start Game Window
Game Play
Game Play GIF
Restart or Quit as the Game ends.