Turtle Crossing: A Classic Arcade Game Revisited in Python

Let's take a stroll down memory lane and revisit the classic arcade game, Turtle Crossing, in Python! This fun game poses a challenge with its overwhelming car production, but fear not! You can overcome this obstacle by utilizing random draws to keep the game running smoothly. Download the game and access the program code to start playing and learning today.
The Turtle Crossing exercise in Python is of moderate difficulty. It's one of those exercises where if you can solve the basic problem, the rest comes easily. It's a classic arcade game that we used to play as kids in electronic stores with the twenty-drachma coin, not the twenty-euro one. I'm talking about the old silver coin that was the ticket to paradise for kids back then.

The game was built using the Turtle library, and the main issue concerns the number of cars being produced. If a new car is created with every screen refresh (0.1 seconds), you will have 600 cars on your screen every minute, causing unbearable congestion and preventing the game from progressing. On the other hand, if you increase the screen refresh rate, the game runs poorly and appears to "freeze".
This is a classic programming problem that requires "out of the box" thinking to solve. The solution involves using random draws. Instead of creating a new car each time the production function runs, a draw is made from numbers 1 to 5, for example, and a car is only produced when the number 3 is drawn. This restricts new cars by 80%, and your screen refresh rate remains normal.

The game is available for download here and the entire program code can be found here. Just like any other program available on the blog, the exe file has been scanned for viruses using Virus Total.