The command prompt normally prints text line by line, scrolling down. To create smooth animation, we need to overwrite the same area on the screen. The gotoxy() function uses Windows API to move the cursor to any (x, y) coordinate on the console grid. This allows us to redraw only the changing parts of the game arena, eliminating flickering.
Modify the collision system to treat certain coordinates as walls: snake game command prompt code
last_tick = time.time()