DEV Community

HazTechyContent
HazTechyContent

Posted on

How I Cured My Game Addiction With Python

So lately I've been playing a lot of games. And being a (somewhat) productivity nerd, I really want to game less. I was like:

And that is when I had this idea, why not create an app that allows me to play games and use apps like Netflix if I work hard enough for it (that means spend time on productive apps).

So I started coding:

How It went

This Python App is the first project I've ever made using video coding.

Nah just kidding.

Before this I was mostly stuck on CLI toy projects or tutorial hell, I had made a Django market place app, an AI web scrapper but none have come close to this project in terms of shear difficulty and the things I had to learn.

Here is a list of libraries used in this project

  • psutils
  • threading
  • textual (to create a TUI)
  • tkinter (to create a GUI which I haven't started)
  • json
  • datetime
  • poetry So when I started coding I thought it was going to be easy but more deeper I went into this project, the more I realized it is much more complex than my anticipation.
I Started coding.

I had to learn how to get, add, update, modify and remove data from a json files. And then check if a process it active. Allocating time to unproductive apps.

Fucked up real bad and nuked it like 2 - 3 times in the beninging.

Then realizing that sequential execution isn't gonna cut it. Then learning threads. Refactoring code because logic got confused (yes that happened).

Also realizing using pid (process id) to track apps was a bad idea (thanks AI you really screwed me) because there are mulitple processes of the same name so pid for each of them is going to be separate.

Refactoring my code again to use process name. Then finding out that this app is utilizing 25% of my CPU (I was genuinely surprised). Learned how to optimize code (which was easy).

So yeah

It was nothing short of chaos. After near 500 lines of code and a month later, I have to admit these were the most difficult lines of code I had ever written.

No Tutorials, no AI. Just Pure Agony

And after an entire month of pain. I finally made it.

The most ironic part?

Instead of using it every day to stop gaming, what actually happened was that during this period I dropped gaming almost entirely because coding became my default activity on my machine and also because I switched to Linux.

[!WARNING]
I use arch btw

It honestly kind of makes me sad, spending so much time on something I would never use. Still I'm really happy with the project and as of today I'm making a tui (terminal user interface which is a gui in a terminal) for it.

Closing Thoughts

Creating this changed me. It made me realize that coding is actually hard. And yet completing it (by completing I mean core logic is done) really made me confident in my skills, it showed me that anyone can actually make good things.

My imposter syndrome went to basically zero after this project.

The fact that you can learn a lot from a unique and a large project is genuinely freakin amazing.

I would genuinely suggest every coder out there to build scary projects that force you to get out of your comfort zone because:

The PATH to PARADISE begins in HELL!!!

Cheers mate

Sic Parvis Magna | Greatness from small beginnings
~ Sir Francis Drake

[!Note]
Can you people give me some project ideas.
I really want to make something else.

Top comments (0)