Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.direnv/
.envrc
.idea
__pycache__
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/random-art.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

633 changes: 633 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Binary file added __pycache__/random_art.cpython-34.pyc
Binary file not shown.
Binary file added color-2003614013337317950-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-2021934931182021056-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-2089754148521556226-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-2700922987011559092-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-2706519768263327060-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-3025888747600223972-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-3522738849504052395-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-3975553341943276789-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-4221611059531450236-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-5617844971116684889-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-6419912547704686788-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-6559147568966896629-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-7492650491720358965-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-8650388192720151371-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added color-9006002131007938168-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions create_art.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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__':
Expand Down
Binary file added favorite_random_pic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 49 additions & 2 deletions random_art.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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


Expand Down