DEV Community

Rayleigh Rozier
Rayleigh Rozier

Posted on

Celebrating Georgia's National Championship with Python

If we’ve spoken at any point in the past month, you probably know two things about me:

I really want to be a web developer, and I love college football.

Both of those interests were shoved to the forefront of my life on January 10th. I had my first day of coding bootcamp, while the Georgia Bulldogs won their first national championship in 42 years. I’ll let you decide which of those accomplishments is more impressive.

I’ve been cheering for the Dawgs since I was old enough to hold a pompom, and on most fall Saturdays, you can find the whole Rozier family in the east end zone of Sanford Stadium. It only felt right to pay tribute to my team’s historic season with my very first bootcamp project.

My class was asked to demonstrate our knowledge of Python by creating a game over the course of a week. We were given the example of a knight fighting a goblin, but naturally, my brain went straight to football.

I decided to create a game in which you become Georgia’s new head coach, and try to lead the team to another national title. It’s like those PlayStation NCAA games, but entirely text-based, so your cheating younger brother can’t throw Hail Mary’s on every turn. And of course, it’s called “Dawgs on Top.”

Image description

My first major challenge was figuring out a scoring system, and that took up most of my first day. In the given example, the knight and goblin were supposed to lose health until one of them dies. Thankfully in football, the players don’t die when they lose, so I had to come up with a different way of declaring a winner.

I decided scoring would be based on 3 major stats: offense, defense, and experience. The decisions you make as coach impact those stats, and therefore your chances of winning the game. A higher offense stat increases the number of points you can score. Higher defense allows you to take your opponent’s points off the board. Experience impacts both sides of the ball by improving your probability on offense and defense.

Once I had that basic structure, I also had to add some conditions to make the game more realistic. I wanted my game’s scores to actually look like football scores. That meant no team can score only 1 or 4 points, and by the end, your offense can’t be so powerful that you score over 100 points per game. Coming up with those conditions and testing them out took the better part of an afternoon.

Image description

Another logistical challenge I had was learning to deal with many nested loops.
While playtesting, I discovered it was impossible to quit my game if you were too deep into the season. When you asked to return to the main menu, the game would instead cycle through menus for opponents you already played. I used the power of the internet to learn about flag variables, and they saved me from accidentally creating a never-ending football season.

Three weeks into my course, I still have a lot to learn about Python, but making this game really helped cement what I’ve learned so far. It led to a lot of repetition and problem-solving, and I definitely feel more comfortable coding now than I did at the beginning of this week.

I realize this game will only resonate with a very particular set of college football fans (and will be despised Alabama fans). That’s okay! I had a lot of fun putting this together and winning an infinite number of national titles from the comfort of my terminal.

If you’d like to give it a try, check out my GitHub.

Good luck and Go Dawgs!

Top comments (0)