Using python's curses module to reduce flickering in terminal games
Im not a huge fan of text adventures and the like.
But you may have noticed that they suffer from terminal flicker if they include things like a minigame where the player can move around outside of being narrated by text.
So, I created this well commented example of python's curses module that can reduce or completely eliminate such flickering.
Why it helps
Normally to do something like draw a map of where the player is in an environment, you would clear the screen and redraw the map.
This is how most terminal games on replit do it.
But redrawing the map takes some time, and since the screen has been cleared you get a brief moment where the screen is completely clear until the map data is written onto it character by character
So what if instead of clearing the screen first then drawing the map, you do them both at the same time?
Thats where curses comes in.
Curses buffers the changes you make and only displays them after you call its refresh function, this way all the changes you made are displayed at the same time!