https://github.com/maheera421/turtle-race
A thrilling Turtle Race Game with 6 turtles battling it out!
https://github.com/maheera421/turtle-race
turtle-graphics
Last synced: 4 months ago
JSON representation
A thrilling Turtle Race Game with 6 turtles battling it out!
- Host: GitHub
- URL: https://github.com/maheera421/turtle-race
- Owner: maheera421
- Created: 2024-07-12T17:06:57.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-13T12:13:35.000Z (about 1 year ago)
- Last Synced: 2025-03-14T01:22:02.122Z (7 months ago)
- Topics: turtle-graphics
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Turtle-Race
🐢 **Code Description**:The code simulates a fun turtle race game using Python's `turtle` module. Users can place bets on which turtle they think will win the race. The game displays a race between six turtles, each with a different color. Once the user places their bet, the race starts, and the turtles move forward randomly until one of them crosses the finish line.
🏁 **Specifications of the Code**:
1. **Setting Up the Screen**:
- The screen is set up with dimensions 500x400 pixels.
- The user is prompted to place a bet on a turtle by entering a color.2. **Creating Turtles**:
- Six turtles with different colors (`red`, `orange`, `yellow`, `green`, `blue`, `purple`) are created.
- These turtles are positioned at the starting line with specific y-coordinates.3. **Starting the Race**:
- The race starts if the user places a bet.
- The turtles move forward by a random distance between 0 and 10 pixels in each iteration of the loop.4. **Determining the Winner**:
- The race continues until one of the turtles crosses the finish line (x-coordinate > 230).
- The color of the winning turtle is compared with the user's bet to determine if the user won or lost the bet.
- A message is displayed to the user indicating the outcome.5. **Ending the Race**:
- The race stops, and the screen remains open until the user clicks on it to close.