Skip to content
Merged
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
35 changes: 21 additions & 14 deletions turtleRace.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import turtle
# importing the turtle
from turtle import Turtle, Screen
import random

Expand All @@ -14,7 +14,8 @@

# Ask a question and Enter you input message

Answer = screen.textinput("Question", prompt="Which turtle color will win the race?")
player1 = screen.textinput("Player1 Choose", prompt="Which turtle color will win the race?")
player2 = screen.textinput("Player2 Choose", prompt="Which turtle color will win the race?")

# print(Answer)

Expand All @@ -35,41 +36,47 @@


for pick in range(0, 7):

userNames = Turtle() # userNames.shape('turtle')
userNames.shape("turtle")
userNames.color(rainbowColors[pick])
userNames.penup()
userNames.goto(-335, y_Position[pick])
newTurtle.append(userNames)

print(newTurtle)

# print(newTurtle)

if Answer:
if player1 != '' and player2 != '':
is_RaceOn = True


while is_RaceOn:

for turtle in newTurtle:
print(turtle)
if turtle.xcor() > 320:
winnerTurtle = turtle.pencolor()

print(winnerTurtle)
is_RaceOn = False
if player1 == winnerTurtle:
print(f"Player1 Won, the {winnerTurtle} turtle won the race")

elif player2 == winnerTurtle:
print(f"Player2 Won, the {winnerTurtle} turtle won the race")
else:
print(f"You both loose, the {winnerTurtle} turtle won the race")
# print(turtle)
count = random.randint(0, 10)
#newSelect = random.choice(y_Position)
turtle.forward(count)




# def pickUser():
# for name in userNames:
# name.



# for n in userNames:
# if n in userNames:
# n.goto(-335, 30)
# for n in userNames:
# if n in userNames:
# n.goto(-335, 30)

# pam = Turtle()
# pam.color("orange")
Expand Down