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
Binary file added .DS_Store
Binary file not shown.
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.

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Random Art

## Description

Create art using Python's random module and math functions.
Expand Down
Binary file added __pycache__/random_art.cpython-34.pyc
Binary file not shown.
8 changes: 4 additions & 4 deletions create_art.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def make_gray(seed, num_pics=1, width=300):
gray_exp = create_expression()
print("{}: {}".format(filename, gray_exp))
image = generate_monochrome_image(gray_exp, width)
image.save(filename, "PNG")

#image.save(filename, "PNG")
image.show()

def make_color(seed, num_pics=1, width=300):
"""Creates n color image files named color0.png, color1.png, ..."""
Expand All @@ -71,8 +71,8 @@ def make_color(seed, num_pics=1, width=300):
green_exp,
blue_exp))
image = generate_rgb_image(red_exp, green_exp, blue_exp, width)
image.save(filename, "PNG")

#image.save(filename, "PNG")
image.show()

if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Create random art.')
Expand Down
6 changes: 5 additions & 1 deletion random_art.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import random
import os

# Your job is to create better version of create_expression and
# run_expression to create random art.
Expand All @@ -8,7 +9,10 @@
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

# After about 100 different attempts, this created the best image.
z = random.random()/random.random()**4
expr = lambda x, y: (x*y/z)
return expr


Expand Down
Binary file added the_80s_called.bmp
Binary file not shown.
Binary file added the_best_one.bmp
Binary file not shown.
Binary file added tmp1gkuq3vb.bmp
Binary file not shown.
Binary file added tmp4t39irde.bmp
Binary file not shown.
Binary file added tmp774mbcas.bmp
Binary file not shown.
Binary file added tmpfr_3b1w2.bmp
Binary file not shown.
Binary file added tmpg0jlblpy.bmp
Binary file not shown.
Binary file added tmpkqvvb092.bmp
Binary file not shown.
Binary file added tmpo_95sstp.bmp
Binary file not shown.
Binary file added tmppd5e3omz.bmp
Binary file not shown.
Binary file added tmpqq44nfdc.bmp
Binary file not shown.
Binary file added tmpur8fyzzs.bmp
Binary file not shown.
Binary file added tmpwofpuf7g.bmp
Binary file not shown.
Binary file added tmpwos7x43r.bmp
Binary file not shown.