Skip to content

Conversation

stanley6716
Copy link

The origin code might be #13
The following code should be the correct one.

import random

import pylab

dt = pylab.linspace(0, 12 * pylab.pi, 10000)
xs = pylab.sin(dt) * (
pylab.exp(pylab.cos(dt)) - 2 * pylab.cos(4 * dt) + (pylab.sin(dt / 12)) ** 5
)
ys = pylab.cos(dt) * (
pylab.exp(pylab.cos(dt)) - 2 * pylab.cos(4 * dt) + (pylab.sin(dt / 12)) ** 5
)

for i in range(5):
for j in range(5):
c = [random.random() for x in range(3)]
pylab.fill(xs + j * 10, ys + i * 10, color=c)
for i in range(5):
for j in range(5):
if i == j or i + j == 4:
c = [random.random() for x in range(3)]
pylab.fill(xs + (j + 6) * 10, ys + i * 10, color=c)

pylab.axis("off")
pylab.show()

The origin code might be OpenMCL#13 
The following code should be the correct one.

import random

import pylab

dt = pylab.linspace(0, 12 * pylab.pi, 10000)
xs = pylab.sin(dt) * (
    pylab.exp(pylab.cos(dt)) - 2 * pylab.cos(4 * dt) + (pylab.sin(dt / 12)) ** 5
)
ys = pylab.cos(dt) * (
    pylab.exp(pylab.cos(dt)) - 2 * pylab.cos(4 * dt) + (pylab.sin(dt / 12)) ** 5
)

for i in range(5):
    for j in range(5):
        c = [random.random() for x in range(3)]
        pylab.fill(xs + j * 10, ys + i * 10, color=c)
for i in range(5):
    for j in range(5):
        if i == j or i + j == 4:
            c = [random.random() for x in range(3)]
            pylab.fill(xs + (j + 6) * 10, ys + i * 10, color=c)

pylab.axis("off")
pylab.show()
Copy link
Contributor

@StephLin StephLin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Your comment is correct.

I leave a comment in your patch. Please update code to this branch accordingly. Thank you!

@@ -22,3 +22,5 @@

pylab.axis("off")
pylab.show()

# The code is in wrong order.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove them and move the whole code to src/ch05/13.py. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants