Turtle Race
Project Description
The Turtle Race is an engaging and interactive desktop application built using Python's Turtle graphics library. This fun game combines elements of chance and strategy, allowing users to bet on turtles racing to a finish line. The application also incorporates user authentication, enabling both new and returning users to manage their profiles and track their points.
Features
-
User Authentication:
- New users can create a username and password, with their details and starting points recorded in a CSV file (
usersdata.csv). - Returning users can log in with their existing credentials, retrieving their saved points.
- New users can create a username and password, with their details and starting points recorded in a CSV file (
-
User Interface:
- Full-screen mode for an immersive gaming experience.
- Colorful and dynamic graphics created using the Turtle graphics library.
- Text inputs for user interaction and bet placement.
-
Gameplay:
- Four colorful turtles (blue, pink, yellow, and red) race on a defined track.
- Users place bets on which turtle they think will win the race.
- Turtles move randomly across the screen, adding excitement and unpredictability to each race.
- The game declares a winner based on which turtle crosses the finish line first.
-
Scoring System:
- Points are awarded or deducted based on the outcome of the race and the user's bet.
- Scores are updated in real-time and saved to the user's profile for future sessions.
-
Visual and Sound Effects:
- Eye-catching animations as turtles race and celebrate victory.
- Visual feedback on successful login, betting results, and end-of-game messages.
Technical Details
-
Languages and Libraries:
- Python for the core logic.
- Turtle for graphics and animations.
- Pandas and CSV for user data management.
-
CSV Data File (
usersdata.csv):- Stores user credentials and points.
- Columns include
Name,Password, andPoints.
How It Works
-
User Authentication:
- On launch, users are asked if they are new or returning.
- New users register with a username and password, starting with 5000 points.
- Returning users log in, with their details verified against the CSV file.
-
Gameplay Setup:
- Users are welcomed with a custom message and current score displayed.
- The game screen transitions to the racetrack, setting up the turtles and the finish line.
-
Betting:
- Users choose a turtle to bet on (options 1-4).
- Users enter the amount of points they wish to bet, ensuring it does not exceed their current points.
-
Race:
- Turtles race with random movements towards the finish line.
- The race continues until one turtle crosses the finish line, determining the winner.
-
Results:
- If the user's chosen turtle wins, they gain points equivalent to their bet.
- If another turtle wins, the user loses the bet amount from their score.
- Updated points are saved to the CSV file.
-
Repeat or Exit:
- Users are given the option to play again or exit.
- On exiting, a thank-you message is displayed.
Usage
- Ideal for casual entertainment and as an educational tool for teaching basic programming concepts with Turtle graphics.
- Encourages users to develop a strategy and manage their points effectively.
GitHub Link
Check out the code and contribute on GitHub:
Emoji Quiz Game Repository