Skip to content

turtle race game #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions turtle race.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from turtle import Turtle
from random import randint

aman=Turtle()
aman.color('blue')
aman.shape('turtle')
aman.penup()
aman.goto(-180,100)
aman.pendown()

swati=Turtle()
swati.color('red')
swati.shape('turtle')
swati.penup()
swati.goto(-180,70)
swati.pendown()

ram=Turtle()
ram.color('green')
ram.shape('turtle')
ram.penup()
ram.goto(-180,40)
ram.pendown()

krishna=Turtle()
krishna.color('dark blue')
krishna.shape('turtle')
krishna.penup()
krishna.goto(-180,10)
krishna.pendown()

for movement in range(100):
aman.forward(randint(1,5))
swati.forward(randint(1, 5))
ram.forward(randint(1, 5))
krishna.forward(randint(1, 5))
if aman.position() > (swati.position() and ram.position()and krishna.position()):
print(("Aman won the race"))
elif swati.position()>(aman.position() and ram.position() and krishna.position()):
print("swati won the race")
elif ram.position()> (aman.position() and swati.position() and krishna.position()):
print("ram won the race")
else:
print("Krishna won the race")



input(" ...")