Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions Snake_game/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import time
from turtle import Turtle, Screen
import random

myScreen = Screen()

snakePosition = [0, -20, -40]
snake_draw = []
# snake_color = ['white', 'white', 'white']

is_running = True

myScreen.setup(width=600, height=600)
myScreen.bgcolor("black")
myScreen.title("Snake_Game ")

myScreen.tracer(0)


for build in range(0, 3):
myT = Turtle()
myT.shape("square")
myT.color('white')
myT.penup()
myT.goto(snakePosition[build], 0)
snake_draw.append(myT)


# if snakePosition == 3:
# is_running = True


while is_running:
myScreen.update()
time.sleep(1)
for snake in snake_draw:
snake.forward(10)

myScreen.exitonclick()
Empty file added snake_game.py
Empty file.
79 changes: 11 additions & 68 deletions turtleRace.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from turtle import Turtle, Screen
import random

# Create a screen method
screen = Screen()

# Give a title to the Windows Interface
Expand All @@ -10,31 +11,24 @@
# Create a scree size to use for the window
screen.setup(700, 500)

# Create a variable and make it False
is_RaceOn = False

# Ask a question and Enter you input message

player1 = screen.textinput("Player1 Choose", prompt="Which turtle color will win the race?")
player2 = screen.textinput("Player2 Choose", prompt="Which turtle color will win the race?")

# print(Answer)

# Create a list of rainbow colors
rainbowColors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']

# userNames = ['jenny', 'pam', 'tom', 'jane', 'jim', 'kim']#, #'sam']

# Create a list for the y position coordinate
y_Position = [-30, -60, -90, 0, 30, 60, 90]

# Create an empty list to hold the turtle position
newTurtle = []

#
# def changeRange(x, y):
# global num
# for num in range(0, 6):
# num = num + 10
# turtle.goto(-335, num)


# For loop to create multiple turtle with different colors
for pick in range(0, 7):
userNames = Turtle() # userNames.shape('turtle')
userNames.shape("turtle")
Expand All @@ -43,11 +37,14 @@
userNames.goto(-335, y_Position[pick])
newTurtle.append(userNames)

# print(newTurtle)

# Check if the players place a bet or have an input
if player1 != '' and player2 != '':
is_RaceOn = True
else:
print("Please pick a color")

# Keep running the turtle until is False
while is_RaceOn:

for turtle in newTurtle:
Expand All @@ -67,59 +64,5 @@
count = random.randint(0, 10)
turtle.forward(count)



# def pickUser():
# for name in userNames:
# name.


# for n in userNames:
# if n in userNames:
# n.goto(-335, 30)

# pam = Turtle()
# pam.color("orange")
# pam.shape('turtle')
# pam.penup()
# pam.goto(-335, 30)
#
# tom = Turtle()
# tom.color("yellow")
# tom.shape('turtle')
# tom.penup()
# tom.goto(-335, 60)
#
# jane = Turtle()
# jane.color("green")
# jane.shape('turtle')
# jane.penup()
# jane.goto(-335, 90)
#
# jim = Turtle()
# jim.color("blue")
# jim.shape('turtle')
# jim.penup()
# jim.goto(-335, -30)
#
# kim = Turtle()
# kim.color("indigo")
# kim.shape('turtle')
# kim.penup()
# kim.goto(-335, -60)
#
# sam = Turtle()
# sam.color("violet")
# sam.shape('turtle')
# sam.penup()
# sam.goto(-335, -90)
#
#
# class Select:
# def __init__(self, color, shape, position):
# self.color = color
# self.shape = shape
# self.position = position


# Create the onclick exit once the task is completed
screen.exitonclick()