diff --git a/Snake_game/main.py b/Snake_game/main.py new file mode 100644 index 0000000..233157e --- /dev/null +++ b/Snake_game/main.py @@ -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() diff --git a/snake_game.py b/snake_game.py new file mode 100644 index 0000000..e69de29 diff --git a/turtleRace.py b/turtleRace.py index 5ceb51f..0bb1d3a 100644 --- a/turtleRace.py +++ b/turtleRace.py @@ -2,6 +2,7 @@ from turtle import Turtle, Screen import random +# Create a screen method screen = Screen() # Give a title to the Windows Interface @@ -10,6 +11,7 @@ # 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 @@ -17,24 +19,16 @@ 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") @@ -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: @@ -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()