Exemple #1
0
def main():
    # Setup pattern
    pattern.setup()
    # Play again loop
    playAgain = True
    while playAgain:
        # Present a menu to the user
        # Let them select 'Super' mode or 'Single' mode
        print("Choose a mode")
        print("1) Rectangle Pattern")
        print("2) Circle Pattern")
        print("3) Super Pattern")
        mode = eval(input("Which mode do you want to play? 1, 2 or 3: "))
        # If they choose 'Rectangle Patterns'
        if mode == 1:
            #### Add Input Statement(s) as needed ####
            centerX, centerY = eval(input("Enter the starting point (X, Y) for the pattern: "))
            offset = int(input("Enter the offset value: "))
            width, height = eval(input("Enter the width and height of the rectangle (10, 20): "))
            rotation = float(input("What rotation for the rectangles would you like? (-360 to 360): "))
            count = int(input("How many rectangles do you want?: "))
            #### End Add Inputs Statement(s) ####
            # Draw the rectangle pattern
            pattern.drawRectanglePattern(centerX, centerY, offset, width, height, count, rotation)
        # If they choose 'Circle Patterns'
        elif mode == 2:
            #### Add Input Statement(s) as needed ####
            centerX, centerY = eval(input("Enter the starting point (X, Y) for the pattern: "))
            offset = int(input("Enter the offset value: "))
            radius = int(input("Enter the radius for the circle: "))
            count = int(input("How many circles do you want?: "))
            #### End Add Inputs Statement(s) ####
            # Draw the circle pattern
            pattern.drawCirclePattern(centerX, centerY, offset, radius, count)
        # If they choose 'Super Patterns'
        elif mode == 3:
            #### Add Input Statement(s) as needed ####
            num = (input("Enter a number: "))
            #### End Add Inputs Statement(s) ####
            if num == "":
                pattern.drawSuperPattern(num=1)
            else:
                pattern.drawSuperPattern(eval(num))
       # Play again?
        print("Do you want to play again?")
        print("1) Yes, and keep drawings")
        print("2) Yes, and clear drawings")
        print("3) No, I am all done")
        response = eval(input("Choose 1, 2, or 3: "))
        #### Add Statement(s) to clear drawings and play again ####
        if response == 1:
            playAgain = True
        elif response == 2:
            pattern.reset()
        else:
            break
        #### End Add Inputs Statement(s) ####
        # print a message saying thank you
    print("Thanks for playing!")
    pattern.done()
Exemple #2
0
def main():
    # Setup pattern.py
    pattern.setup()

    # Play again loop
    playAgain = True

    while playAgain:
        # Present a menu to the user
        # Let them select 'Super' mode or 'Single' mode
        print("Choose a mode")
        print("1) Rectangle Pattern")
        print("2) Circle Pattern")
        print("3) Super Pattern")
        mode = input("Which mode do you want to play? 1, 2 or 3: ")

        # If they choose 'Rectangle Patterns'
        if mode == 1:
            centerX = input("What is the x point? ")
            centerY = input("What is the y point? ")
            offset = input("What is the offset? ")
            width = input("What is the width? ")
            height = input("What is the height? ")
            count = input("How many times should it repeat? ")
            rotation = input("What is the rotation? ")

            # Draw the rectangle pattern.py
            pattern.drawRectanglePattern(centerX, centerY, offset, width, height, count, rotation)

        # If they choose 'Circle Patterns'
        elif mode == 2:
            centerX = input("What is the x point? ")
            centerY = input("What is the y point? ")
            offset = input("What is the offset? ")
            radius = input("What is the radius? ")
            count = input("How many times should it repeat? ")

            # Draw the circle pattern.py
            pattern.drawCirclePattern(centerX, centerY, offset, radius, count)

        # If they choose 'Super Patterns'
        elif mode == 3:
            num = input("How many patterns do you want to make? ")
            if num == "":
                pattern.drawSuperPattern(1)
            else:
                pattern.drawSuperPattern(num)
         # Play again?

        print("Do you want to play again?")
        print("1) Yes, and keep drawings")
        print("2) Yes, and clear drawings")
        print("3) No, I am all done")
        response = input("Choose 1, 2, or 3: ")

        if response == 1:
            playAgain = True
        elif response == 2:
            pattern.reset()
        elif response == 3:
            playAgain = False
            print("Thanks for playing!")
            pattern.done()
Exemple #3
0
def main():
    # Setup pattern
    pattern.setup()

    # Play again loop
    playAgain = True

    while playAgain:
        # Present a menu to the user
        # Let them select 'Super' mode or 'Single' mode
        print("Choose a mode")
        print("1) Rectangle Pattern")
        print("2) Circle Pattern")
        print("3) Super Pattern")
        mode = eval(input("Which mode do you want to play? 1, 2 or 3: "))

        # If they choose 'Rectangle Patterns'
        if mode == 1:
            # Add Input Statement(s) as needed ####
            centerX, centerY = eval(
                input("Enter the center point of pattern (x, y): "))
            offset = eval(input("Enter the offset desired for the pattern: "))
            width = eval(input("Enter the width of rectangle: "))
            height = eval(input("Enter the height of rectangle: "))
            count = eval(
                input(
                    "Enter the number of rectangles you would like in the pattern: "
                ))
            rotation = eval(
                input("Enter the rotation of the rectangles in the pattern: "))

            # Draw the rectangle pattern
            pattern.drawRectanglePattern(centerX, centerY, offset, width,
                                         height, count, rotation)

        # If they choose 'Circle Patterns'
        elif mode == 2:
            # Add Input Statement(s) as needed ####
            centerX, centerY = eval(input("Enter the center point (x, y): "))
            offset = eval(input("Enter the offset desired: "))
            radius = eval(input("Enter the radius for the circles: "))
            count = eval(input("Enter the number of circles in the pattern: "))

            # Draw the circle pattern
            pattern.drawCirclePattern(centerX, centerY, offset, radius, count)

        # If they choose 'Super Patterns'
        elif mode == 3:
            # Add Input Statement(s) as needed ####
            num = input("Enter number of patterns you would like: ")

            if num == "":
                pattern.drawSuperPattern()
            else:
                pattern.drawSuperPattern(eval(num))

        # Play again?
        print("Do you want to play again?")
        print("1) Yes, and keep drawings")
        print("2) Yes, and clear drawings")
        print("3) No, I am all done")
        response = eval(input("Choose 1, 2, or 3: "))

        # Add Statement(s) to clear drawings and play again ####
        if response == 2:
            pattern.reset()
        elif response == 3:
            playAgain = False

    # print a message saying thank you
    print("Thanks for playing!")
    pattern.done()
Exemple #4
0
def main():
    # Setup pattern
    pattern.setup()
    # Play again loop
    playAgain = True
    while playAgain:
        # present menu to user
        # Let them select 'Super' mode or 'Single' mode
        print("Choose a mode")
        print("1) Rectangle Pattern")
        print("2) Circle Pattern")
        print("3) Super Pattern")
        mode = eval(input("Which mode do you want to play? 1, 2 or 3: "))
        # If they choose 'Rectangle Patterns'
        if mode == 1:
            #### Add Input Statement(s) as needed ####

            centerX, centerY = eval(input("Enter a center point(x, y): "))
            offset = int(input("Offset? "))
            height = int(input("Height? "))
            width = int(input("Width? "))
            count = int(input("Count? "))
            rotation = int(input("Rotation? "))

            #### End Add Inputs Statement(s) ####
            # Draw the rectangle pattern
            pattern.drawRectanglePattern(centerX, centerY, offset, width,
                                         height, count, rotation)
        # If they choose 'Circle Patterns'
        elif mode == 2:
            #### Add Input Statement(s) as needed ####

            centerX, centerY = eval(input("Enter a center point(x, y): "))
            offset = int(input("Offset? "))
            radius = int(input("Radius? "))
            count = int(input("Count? "))

            #### End Add Inputs Statement(s) ####
            # Draw the circle pattern
            pattern.drawCirclePattern(centerX, centerY, offset, radius, count)
        # If they choose 'Super Patterns'
        elif mode == 3:
            #### Add Input Statement(s) as needed ####

            num = input("Number? ")

            #### End Add Inputs Statement(s) ####
            if num == "":
                pattern.drawSuperPattern()
            else:
                pattern.drawSuperPattern(eval(num))
        # Play again?
        print("Do you want to play again?")
        print("1) Yes, and keep drawings")
        print("2) Yes, and clear drawings")
        print("3) No, I am all done")
        response = eval(input("Choose 1, 2, or 3: "))
        #### Add Statement(s) to clear drawings and play again ####

        # decide to play again
        playAgain = response == 1 or response == 2

        # clear drawings if needed
        if response == 2:
            pattern.reset()

        #### End Add Inputs Statement(s) ####
    # print a message saying thank you
    print("Thanks for playing!")
    pattern.done()
Exemple #5
0
def main():
    # Setup pattern
    pattern.setup()

    # Play again loop
    playAgain = True

    while playAgain:
        # Present a menu to the user
        # Let them select 'Super' mode or 'Single' mode
        print("Choose a mode")
        print("1) Rectangle Pattern")
        print("2) Circle Pattern")
        print("3) Super Pattern")
        mode = eval(input("Which mode do you want to play? 1, 2 or 3: "))

        # If they choose 'Rectangle Patterns'
        if mode == 1:
            centerX, centerY = eval(input("Enter center point(x, y): "))
            offset = eval(input("Offset? "))
            height = eval(input("Height? "))
            width = eval(input("Width? "))
            count = eval(input("Count? "))
            rotation = eval(input("Rotation? "))

            pattern.drawRectanglePattern(centerX, centerY, offset, height,
                                         width, count, rotation)

        # If they choose 'Circle Patterns'
        elif mode == 2:
            centerX, centerY = eval(input("Enter center point(x, y): "))
            offset = eval(input("Offset? "))
            radius = eval(input("Radius? "))
            count = eval(input("Count? "))

            # Draw the circle pattern
            pattern.drawCirclePattern(centerX, centerY, offset, radius, count)

        # If they choose 'Super Patterns'
        elif mode == 3:
            num = eval(input("Number? "))

            if num == "":
                pattern.drawSuperPattern()
            else:
                pattern.drawSuperPattern(num)

        # Play again?
        print("Do you want to play again?")
        print("1) Yes, and keep drawings")
        print("2) Yes, and clear drawings")
        print("3) No, I am all done")
        response = eval(input("Choose 1, 2, or 3: "))

        if response == 1:
            playAgain = True
        elif response == 2:
            pattern.reset()
            playAgain = True
        else:
            playAgain = False
            pattern.done()
            break
    # print a message saying thank you
    print("Thanks for playing!")