Help with python | Computer Science homework help

the images attached are the instructions, but i have been on this for days with no luck, therefore I have attached my own code as well.

import turtle

import random

z = turtle.Turtle() #global

global window

window = turtle.Screen()

dice = []

buttons = []

def drawCenterDot(z, x, y, width, dotwidth):

    z.penup()

    z.goto(x + width / 2, y – width / 2)

    z.pendown()

    z.dot(dotwidth)

def drawCornerDots(z, x, y, width, dotwidth):

    z.penup()

    z.goto(x + dotwidth, y – dotwidth)

    z.pendown()

    z.dot(dotwidth)

    z.penup()

    z.goto(x + width – dotwidth, y – width + dotwidth)

    z.pendown()

    z.dot(dotwidth)

    

def drawOtherCornerDots(z, x, y, width, dotwidth):

    z.penup()

    z.goto(x + width – dotwidth, y – dotwidth)

    z.pendown()

    z.dot(dotwidth)

    z.penup()

    z.goto(x + dotwidth, y – width + dotwidth)

    z.pendown()

    z.dot(dotwidth)

def drawSideDots(z, x, y, width, dotwidth):    

    z.penup()

    z.goto(x + dotwidth, y – width / 2)

    z.pendown()

    z.dot(dotwidth)

    z.penup()

    z.goto(x + width – dotwidth, y – width / 2)

    z.pendown()

    z.dot(dotwidth)

#Defined drawing some spicy dots 😉 

def drawDots(z, dieValue, x, y, width):

    dotwidth = width // 6

    if dieValue == 1:

        drawCenterDot(z, x, y, width, dotwidth)

    elif dieValue == 2:

        drawCornerDots(z, x, y, width, dotwidth)

    elif dieValue == 3:

        drawCenterDot(z, x, y, width, dotwidth)

        drawOtherCornerDots(z, x, y, width, dotwidth)

    elif dieValue == 4:

        drawCornerDots(z, x, y, width, dotwidth)

        drawOtherCornerDots(z, x, y, width, dotwidth)

    

    elif dieValue == 5:

        drawCenterDot(z, x, y, width, dotwidth)

        drawCornerDots(z, x, y, width, dotwidth)

        drawOtherCornerDots(z, x, y, width, dotwidth)

    

    else:

        drawCornerDots(z, x, y, width, dotwidth)

        drawOtherCornerDots(z, x, y, width, dotwidth)

        drawSideDots(z, x, y, width, dotwidth)

def drawDie(z, value, x, y, width, color=”white”):

    z.penup()

    z.goto(x, y)

    z.setheading(0)

    z.fillcolor(color)

    

    z.pendown()

    z.begin_fill()

    for _ in range(4):

        z.forward(width)

        z.right(90)

    

    z.end_fill()

    z.penup()

    drawDots(z, value, x, y, width)

def mouseClick(x,y):

    global dice

    global buttons

    print(“mouse clicked at position ” +str(x) + “,” + str(y))

    

    for button in buttons:

        count = 0

        if isWithin(x, y,button[0],button[1],button[2],button[3]) == True:

            buttonClick(count)

        else:

            count+=1

    for die in dice:

        count = 0

        if isWithin(x,y,die[1],dice[2],dice[3],dice[4]) == True:

            dieClick(count)

        else:

            count+=1

def isWithin(x, y, a, b, width, height):

    if a < x < a + width and b – height < y < b:

        return True

    else:

        return False

def buttonClick(index):

    global dice

    global z

    global buttons

    if index == 0:

        for die in dice:

            die[4] = “white”

    for die in dice:

        if die[4] == “white”:

            die[0] == random.randint(1,6)

def dieClick(index):

    global dice

    global z

    if dice[index][4] == “white”:

        dice[index][4] = “blue”

    else:

        dice[index][4] == “white”

    return drawDie(z, dice[index][0],dice[index][1],dice[index][2],dice[index][3],dice[index][4])

    

def drawRectangle(z, x, y, width, height, line_color,fill_color, Text = “None”):

    z.penup()

    z.goto(x,y)

    z.pencolor(line_color)

    z.fillcolor(fill_color)

    z.pendown()

    z.begin_fill()

    z.setheading(0)

    z.forward(width)

    z.right(90)

    z.forward(width)

    z.right(90)

    z.forward(width)

    z.right(90)

    z.forward(width)

    z.right(90)

    z.end_fill()

    z.penup()

def main():

    global dice

    global buttons

    global z

    global window

    window.bgcolor(“LightPink”)

    window = turtle.Screen()

    z = turtle.speed(0)

    turtle.hideturtle()

    width = 1000

    height = 800

    

    window.onclick(mouseClick, 1, True)

    window.onclick(buttonClick,1, True)

    turtle.mainloop()

    

    

    dice = dice + [random.randint(1,7)]

    return dice

main()

    

    

    

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more