Programming
505

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



07-Oct-2020 18:00:45

Anjay




Reply


13-Oct-2020 14:02:34



Hallo polisi 


Reply

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
7186
2
Top

Gps Tracker Seccodeid Free Too...
Djie sam soe Djie sam soe
General
5281
164
Top

Free Proxy List
Sandidi Sandidi
Networking
2931
3
Top

Mass Reverse IP Unlimited
ImamSy ImamSy
Hacking
2149
11
Top

Report McAfee Antivirus Hurrri...
Indrasp Indrasp
Windows
1619
93
Top

Related Post

Youtube Video

Subscribe