Connect Four is a classic 2 player game. It is a variation of tic-tac-toe played on a rectangular board. Typically there are 6 rows and 7 columns, although this code will work for any number of rows and columns. The game is played by two players, alternating turns, with each trying to place four checkers in a row vertically, horizontally, or diagonally. Because the board stands vertically and the checkers are subject to gravity, a checker may only be placed at the top of one of the currently existing columns (or it may start a new column). Connect Four is a variation of tic-tac-toe played on a rectangular board. Typically there are 6 rows and 7 columns, although your code will work for any number of rows and columns. The game is played by two players, alternating turns, with each trying to place four checkers in a row vertically, horizontally, or diagonally. Because the board stands vertically and the checkers are subject to gravity, a checker may only be placed at the top of one of the currently existing columns (or it may start a new column).
Follow the steps to run CONNECT 4.
- Fork the Project / Download the source code as a zip file
- Navigate to the project directory
- Run the connect4.py python file
Follow these steps to play CONNECT 4.
- On running the CONNECT 4 application, it will prompt the user to provide the dimensions for the board.
- Once the user has entered the dimensions, a board with the given specifications is created and the users can start playing the game.
- The game starts with X's turn and then based on user's choices, the game progresses.
- The game ends as soon as either of the players has 4 checkers in a row vertically, horizontally, or diagonally.
- After the game ends, the user is prompted if they want to restart the game or not.
- If the user decides to restart, they are again prompted for the new board dimensions.
- If not, then the game terminates.
If you have to add a feature, please fork the repo and create a pull request.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/Feature
) - Commit your Changes (
git commit -m 'Adding Feature'
) - Push to the Branch (
git push origin feature/Feature
) - Open a Pull Request