DEV Community

Cover image for Connect 4 Terminal Game
GravityCodes
GravityCodes

Posted on

Connect 4 Terminal Game

I decided to create this terminal game to test the knowledge I have learned so far of python. It is a very basic game with all the necessary functions to play a game of Connect Four.

I decided to tackle this project by first making a class called connectFour. This class was going to handle mostly all the parts needed to play the game. In the init method, the board, players, game tokens and other information like the rows and columns of the board were created. I also made several functions to handle the placement of tokens and winning conditions.

Once that was done I decided to make another python file to handle what the user sees. Things like "Welcome to connect four" and "Where would you like to place your token?" were all in this file. The turns of the players were managed by a while loop. If none of the winning conditions are met or the game is not tied, it will keep going.

Here is the link to my code on Github:
https://github.com/GravityCodes/Connect-Four

Overall this took me about 7 hours to make. There is probably a lot more I can add to this game to make the playing experience better. Don't be afraid to let me know what you all think about this!

Top comments (4)

Collapse
 
kai123 profile image
Kailyn R

This is perfect! I absolutely love this game, it was really cool that you made this game in coding! I learned a lot😁

Collapse
 
gravitycodes profile image
GravityCodes

Thank you for trying it out!

Collapse
 
denii07 profile image
Denisse Rodriguez

This is amazing! Keep up the good work!!!

Collapse
 
gravitycodes profile image
GravityCodes

Thank you!