"""
Program: CS115 Project 2
Author: Your name here.
Description: TBD
"""
from graphics import *
import sys
import random
import math
def random_color():
'''Produces a random color.
Returns:
str: a string representing a color.
'''
colors = ['blue', 'blue2', 'blue3', 'green', 'green2', 'green3',
'orange', 'orange2', 'orange3', 'red', 'red2', 'red3',
'purple', 'purple2', 'purple3', 'yellow', 'yellow2', 'yellow3',
'gray', 'gray2', 'gray3', 'pink', 'pink1', 'pink2', 'pink3']
return colors[random.randint(0, len(colors) - 1)]
def random_integer(bound):
'''Produces a random integer in the range 0 -- (bound-1).
Returns:
int: the integer.
'''
return random.randrange(0, bound)
def draw_square(window, x, y, s, color):
'''Draws a square at (x, y) of length s.
Args:
window (GraphWin): The window.
x (int): The x-coordinate of the square's upper-left corner.
y (int): The y-coordinate of the square's upper-left corner.
s (int): The length of the square's side.
color (str): The color of the square.
Returns:
None
'''
pass
def draw_ring(window, x, y, r, w, color):
'''Draws a ring centered at (x,y) of radius r and width w.
Args:
x (int): The x-coordinate of the rings's center.
y (int): The y-coordinate of the rings's center.
r (int): The distance from the center to the outer edge of the ring.
w (int): The distance from the inner edge to the outer edge of the ring.
color (str): The color of the ring border.
Returns:
None
'''
pass
def draw_hexagon(window, x, y, d, color):
'''Draws a hexagon centered at (x,y) with long diagonal d.
Args:
window (GraphWin): The window.
x (int): The x-coordinate of the hexagon's center.
y (int): The y-coordinate of the hexagon's center.
d (int): The length of the hexagon's long diagonal.
color (str): The color of the shape.
Returns:
None
'''
pass
def draw_octagon(window, x, y, d, color, scolor):
'''Draws an octagon centered at (x,y) with long diagonal d. Each
octagon is bordered on the north, south, east and west sides by
rectangles. Each rectangle should share an edge with the octagon,
and the other edge should be half that length.
Args:
window (GraphWin): The window.
x (int): The x-coordinate of the octagon's center.
y (int): The y-coordinate of the octagon's center.
d (int): The length of the octagon's long diagonal.
color (str): The color of the hexagon.
scolor (str): The color of the rectangle bordering the octagon.
Returns:
None
'''
pass
def draw_square_line(window, x, y, s):
'''Draws a line of squares, where one has upper-left corner at (x,y).
The square color is randomly selected, and each square has side length s.
Args:
window (GraphWin): The window.
x (int): The x-coordinate of the square's upper-left corner.
y (int): The y-coordinate of the square's upper-left corner.
s (int): The length of the square's side.
Returns:
None
'''
pass
def draw_ring_line(window, x, y, r):
'''Draws a line of rings, where one ring is centered at (x,y).
The border of each ring has a randomly selected color, and a randomly
chosen border of width in the range 1 -- (r-1).
Args:
window (GraphWin): The window.
x (int): The x-coordinate of the rings's center.
y (int): The y-coordinate of the rings's center.
r (int): The distance from the center to the outer edge of the ring.
Returns:
None
'''
pass
def draw_hexagon_line(window, x, y, d):
'''Draws a lines of hexagons, where one hexagon is centered at (x,y)
and each subsequent hexagon is adjacent to a prior hexagon in the line.
Each hexagon has a randomly selected color.
Args:
window (GraphWin): The window.
x (int): The x-coordinate of an hexagon's center.
y (int): The y-coordinate of an hexagon's center.
d (int): The length of the hexagon's long diagonal.
Returns:
None
'''
pass
def draw_octagon_line(window, x, y, d, c):
'''Draw a line of octagons. Each octagon has a randomly selected color.
Args:
window (GraphWin): The window.
x (int): The x-coordinate of an octagon's center.
y (int): The y-coordinate of an octagon's center.
d (int): The length of the octagon's long diagonal.
c (str): The color of the boxes adjacent to the octagon's edges.
Returns:
None
'''
pass
def tile_squares(window, s):
'''Draws squares of side length s, tiling these over the full graphics
window. The upper-right corner of the first square should begin at a
random location (x,y), where x is selected from the interval (-s+1) -- 0,
and y from the interval (-s+1) -- 0
The color of each square is randomly selected.
Args:
window (GraphWin): The window.
s (int): The side length of the square.
Returns:
None
'''
pass
def tile_rings(window, r):
'''Draws rings of radius r, tiling these over the full graphics window.
The center of the first ring should begin at a random location (x,y),
where x is selected from the interval (-r+1) -- r, and y from the
interval (-r+1) -- r.
The color of each ring is randomly selected, and the border of each ring
is randomly selected in the range 1 -- (r-1).
Args:
window (GraphWin): The window.
r (int): The radius of the ring.
Returns:
None
'''
pass
def tile_hexagons(window, d):
'''Draws hexagons, tiling these over the full graphics window.
The center of the first shape should begin at a random location (x,y),
where x is selected from the interval (-d+1) -- 0, and y from the
interval (-d+1) -- 0.
Args:
window (GraphWin): The window.
d (int): The length of the hexagon's long diagonal.
Returns:
None
'''
pass
def tile_octagons(window, d):
'''Draws octagons, tiling these over the full graphics window.
The center of the first shape should begin at a random location (x,y),
where x is selected from the interval (-d+1) -- 0, and y from the
interval (-d+1) -- 0.
The squares used to space the octagons should have the same, randomly
selected color. The foreground octagons should each have a randomly
selected colors. The background octagons (the octagons created by the
negative space) will just be the color of window (by default, white).
Args:
window (GraphWin): The window.
d (int): The length of the octagon's long diagonal.
Returns:
None
'''
pass
def get_selection():
'''Shows a menu and then gets input from the user.
Returns:
int: an integer indicating the user's selection (1--13), or 0 if
their selection was invalid, or -1 if they selected to Quit.
'''
pass
def main():
random.seed() # Initialize random number generator
print("---> Tessellation Creator <---")
print()
# TODO: get the window width and height
# TODO: get the selection
# TODO: While the selection does not indicate the user wants to quit
# TODO: Depending on the operation, prompt the user for those
# parameters relevant to the requested operation
# TODO: If the operation will draw something (1--13), make a GraphWin
# TODO: Depending on the operation, make the appropriate function call
# TODO: if the operation drew something, wait for a click and close the
# TODO: get the next selection
main()