Turtle Race Game

# Please use below link for live demo
https://trinket.io/python/513ddc86ec

#!/bin/python3

from turtle import *
from random import randint

speed(0)
penup()
goto(-140, 140)

for step in range(15):
  write(step, align='center')
  right(90)
  forward(10)
  pendown()
  forward(150)
  penup()
  backward(160)
  left(90)
  forward(20)

ada = Turtle()
ada.color('red')
ada.shape('turtle')

ada.penup()
ada.goto(-160, 100)
ada.pendown()

bob = Turtle()
bob.color('blue')
bob.shape('turtle')

bob.penup()
bob.goto(-160, 70)
bob.pendown()

usman = Turtle()
usman.color('black')
usman.shape('turtle')

usman.penup()
usman.goto(-160, 40)
usman.pendown()

ali = Turtle()
ali.color('yellow')
ali.shape('turtle')

ali.penup()
ali.goto(-160, 10)
ali.pendown()

for turn in range(100):
  ada.forward(randint(1,5))
  bob.forward(randint(1,5))
  usman.forward(randint(1,5))
  ali.forward(randint(1,5))  

Comments

Popular posts from this blog

Asterisk-AMI

Mini-Max Sum solution in Python

Hackerrank Birthday Cake Candles Challenge Solution in Python