Programming
613

Turtle game race using python






  05-Oct-2020 21:30:55



Turtle Race Game using python


import turtle

import random


player_one = turtle.Turtle()

player_one.color("green")

player_one.shape("turtle")

player_one.penup()

player_one.goto(-200,100)

player_two = player_one.clone()

player_two.color("blue")

player_two.penup()

player_two.goto(-200,-100)


player_one.goto(300,60)

player_one.pendown()

player_one.circle(40)

player_one.penup()

player_one.goto(-200,100)

player_two.goto(300,-140)

player_two.pendown()

player_two.circle(40)

player_two.penup()

player_two.goto(-200,-100)


die = [1,2,3,4,5,6]


for i in range(20):

    if player_one.pos() >= (300,100):

            print("Player One Wins!")

            break

    elif player_two.pos() >= (300,-100):

            print("Player Two Wins!")

            break

    else:

            player_one_turn = input("Press 'Enter' to roll the die ")

            die_outcome = random.choice(die)

            print("The result of the die roll is: ")

            print(die_outcome)

            print("The number of steps will be: ")

            print(20*die_outcome)

            player_one.fd(20*die_outcome)

            player_two_turn = input("Press 'Enter' to roll the die ")

            d = random.choice(die)

            print("The result of the die roll is: ")

            print(die_outcome)

            print("The number of steps will be: ")

            print(20*die_outcome)

            player_two.fd(20*die_outcome) 


SOURCE : @Programmerjokes


DISCUSSION
Nothing comment here :(
Login for comment and discussion.
Login Here
Sponsored

Oppss... No sponsors yet

Popular Posts
Complete Basic Course in Kali...
Djie sam soe Djie sam soe
Linux
12531
2
Top

Gps Tracker Seccodeid Free Too...
Djie sam soe Djie sam soe
General
7361
167
Top

Free Proxy List
Sandidi Sandidi
Networking
3166
3
Top

Mass Reverse IP Unlimited
ImamWawe ImamWawe
Tools Hacking
2571
12
Top

Xampp msyql error cant running
Karno si kribo Karno si kribo
Web Development
1777
25
Top

Related Post

Youtube Video

Subscribe