Programming
345

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
Popular Posts
Gps Tracker Seccodeid Free Too...
Dji sam soe Dji sam soe
General
3127
145
Top

Free Proxy List
Sandidi Sandidi
Networking
1926
3
Top

Mass Reverse IP Unlimited
ImamSy ImamSy
Hacking
1684
10
Top

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

GHunt OSINT Tools - Investiga...
Sandidi Sandidi
Tools Hacking
993
3
Top

Related Post

Subscribe

Subscribe free now for latest posts