Inspiration
I had tons of fun playing 4-in-a-row games back in my childhood with my family and classmates, as well as similar games such as Go and Gomoku so I wanted to make a 4-in-a-row game and create an AI that was fun to play with.
What it does
Running the main file opens a Pygame window where a user can play the game as many times as they want against an AI.
How I built it
The game is displayed with the Pygame framework by drawing in components of UI in the main game loop and the information for the board is stored in a dictionary which is updated as the board state changes. The AI has 5 levels in which it checks the board for situations from most important to least important and makes a move accordingly.
Challenges I ran into
When I wrote the reset function for playing the game multiple times without re-running the program, I encountered a bug that prevented objects from being created after they initially were.
Accomplishments that I'm proud of
Most of all, I'm proud that I did all of the project on my own, without the help of any tutorials or friends, but by reading the pygame documentation and pushing myself to solve all the problems.
I'm very happy with how the final result looks, given that this is the first time I have ever created UI and used Pygame, as well as my first game in general! I'm also very proud of the method I created to "animate" the color changing for the highlighted column where I created a list of color gradients by appending modified RGB code colors in a loop and then checked during the main loop the time to have the colors loop through the gradient.
What I learned
I learned some important fundamentals of creating games, most intriguing to me, what a "frame" is. I also learned the structure of the main game loop and how to interact with stored data in an effective way. I learned how to use the pygame framework, as well as the process for designing games.
What's next for Go For Four
I want to improve the AI by bringing in machine learning to give it positional strategy, as well as improve the UI.
Log in or sign up for Devpost to join the conversation.