Programming
845

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

*Beware click the link!


DISCUSSION
Nothing comment here :(
Login for report, comment and join discussion
Login Here
Sponsored

Popular Posts
Gps Tracker Seccodeid Free Too...
General
21165
202
Top


Djie sam soe Djie sam soe
Complete Basic Course in Kali...
Linux
14157
4
Top


Djie sam soe Djie sam soe
Komintod (Ministry of Communic...
Data Leak
6396
70
Top


Murtad methamphetamine Murtad methamphetamine
Free Proxy List
Networking
3596
3
Top


Sandidi Sandidi
Mass Reverse IP Unlimited
Tools Hacking
3314
13
Top


ImamWawe ImamWawe

Related Post

Youtube Video

Subscribe