diff --git a/.gitignore b/.gitignore index 9b42106..e82b99d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ .direnv/ +.envrc +.idea +__pycache__ diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..3f72c60 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +random-art \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..21109db --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..77e9ae2 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/random-art.iml b/.idea/random-art.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/random-art.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..43e5517 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,633 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1433783852882 + + + 1433794651712 + + + 1433800474089 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__pycache__/random_art.cpython-34.pyc b/__pycache__/random_art.cpython-34.pyc new file mode 100644 index 0000000..8d94fcf Binary files /dev/null and b/__pycache__/random_art.cpython-34.pyc differ diff --git a/color-2003614013337317950-0.png b/color-2003614013337317950-0.png new file mode 100644 index 0000000..b238f5f Binary files /dev/null and b/color-2003614013337317950-0.png differ diff --git a/color-2021934931182021056-0.png b/color-2021934931182021056-0.png new file mode 100644 index 0000000..09fd17e Binary files /dev/null and b/color-2021934931182021056-0.png differ diff --git a/color-2089754148521556226-0.png b/color-2089754148521556226-0.png new file mode 100644 index 0000000..7cbe01a Binary files /dev/null and b/color-2089754148521556226-0.png differ diff --git a/color-2700922987011559092-0.png b/color-2700922987011559092-0.png new file mode 100644 index 0000000..188c001 Binary files /dev/null and b/color-2700922987011559092-0.png differ diff --git a/color-2706519768263327060-0.png b/color-2706519768263327060-0.png new file mode 100644 index 0000000..a08c77e Binary files /dev/null and b/color-2706519768263327060-0.png differ diff --git a/color-3025888747600223972-0.png b/color-3025888747600223972-0.png new file mode 100644 index 0000000..51853e9 Binary files /dev/null and b/color-3025888747600223972-0.png differ diff --git a/color-3522738849504052395-0.png b/color-3522738849504052395-0.png new file mode 100644 index 0000000..13c0610 Binary files /dev/null and b/color-3522738849504052395-0.png differ diff --git a/color-3975553341943276789-0.png b/color-3975553341943276789-0.png new file mode 100644 index 0000000..2bb34f7 Binary files /dev/null and b/color-3975553341943276789-0.png differ diff --git a/color-4221611059531450236-0.png b/color-4221611059531450236-0.png new file mode 100644 index 0000000..457e0e7 Binary files /dev/null and b/color-4221611059531450236-0.png differ diff --git a/color-5617844971116684889-0.png b/color-5617844971116684889-0.png new file mode 100644 index 0000000..5cfae72 Binary files /dev/null and b/color-5617844971116684889-0.png differ diff --git a/color-6419912547704686788-0.png b/color-6419912547704686788-0.png new file mode 100644 index 0000000..b68472d Binary files /dev/null and b/color-6419912547704686788-0.png differ diff --git a/color-6559147568966896629-0.png b/color-6559147568966896629-0.png new file mode 100644 index 0000000..0d41e97 Binary files /dev/null and b/color-6559147568966896629-0.png differ diff --git a/color-7492650491720358965-0.png b/color-7492650491720358965-0.png new file mode 100644 index 0000000..39a9897 Binary files /dev/null and b/color-7492650491720358965-0.png differ diff --git a/color-8650388192720151371-0.png b/color-8650388192720151371-0.png new file mode 100644 index 0000000..d316032 Binary files /dev/null and b/color-8650388192720151371-0.png differ diff --git a/color-9006002131007938168-0.png b/color-9006002131007938168-0.png new file mode 100644 index 0000000..ae84a88 Binary files /dev/null and b/color-9006002131007938168-0.png differ diff --git a/create_art.py b/create_art.py index ba3cb55..72deada 100644 --- a/create_art.py +++ b/create_art.py @@ -56,6 +56,7 @@ def make_gray(seed, num_pics=1, width=300): print("{}: {}".format(filename, gray_exp)) image = generate_monochrome_image(gray_exp, width) image.save(filename, "PNG") + image.show() def make_color(seed, num_pics=1, width=300): @@ -72,6 +73,7 @@ def make_color(seed, num_pics=1, width=300): blue_exp)) image = generate_rgb_image(red_exp, green_exp, blue_exp, width) image.save(filename, "PNG") + image.show() if __name__ == '__main__': diff --git a/favorite_random_pic.png b/favorite_random_pic.png new file mode 100644 index 0000000..1fe7905 Binary files /dev/null and b/favorite_random_pic.png differ diff --git a/random_art.py b/random_art.py index b13271b..2d4a7fd 100644 --- a/random_art.py +++ b/random_art.py @@ -1,4 +1,5 @@ import random +from math import sin, cos, pi, tan, sqrt # Your job is to create better version of create_expression and # run_expression to create random art. @@ -7,8 +8,54 @@ def create_expression(): """This function takes no arguments and returns an expression that - generates a number between -1.0 and 1.0, given x and y coordinates.""" - expr = lambda x, y: (random.random() * 2) - 1 + generates a number between -1.0 and 1.0, given + return expr x and y coordinates.""" + + a = random.triangular() + z = random.random() + m = z - 1 + n = z - 10 + o = a + z * pi + gauss_graph = random.gauss(m, n) + + + def function_one(x, y): + + return sin(sin(x) + cos(y) * pi * sin(a * o)) + + def function_two(x, y): + return sin((gauss_graph * sin(x) + sin(y)) * a) + def function_three(x, y): + return (sin(a + z) + (pi * x)) + o**2 + def function_four(x, y): + triangle = random.triangular(x, y) + return sin(sin(a * x) + tan(y)) + sin((sin(a * -x))) * ((x + triangle**2) - y) + def function_five(x, y): + triangle = random.triangular(z,m)**2 + return sin(triangle * -x * y) + pi**2 + def function_six(x, y): + + var = random.uniform(x,y) * (pi * x * y)/ 2 + + return var + def function_seven(x, y): + return sin(x + y) + cos(y) * ((pi**2) / z) + + + function_list = [function_one, function_two, function_three, function_four, function_five, function_six, \ + function_seven] + + random_function = random.choice(function_list) + + def expr(x,y): + + + return ((a * z * (random_function(x, y)) / pi) + (random_function(x, y) * a**2) + ((sin(random_function(x, y) \ + + random_function(x, y)) * pi**2) * pi**2) * pi**2) + + + + return expr