Anyone doing the Conway's Game of Life? I've started on that and am understanding what is going on with the code provided (*I think*), but am unsure of how to get the random blocks. I tried a for loop to go through the dictionary of block_list, but nothing happens. Any ideas? Here's what I have:
for blocks in range(len(self.block_list)):
for squares in range(len(self.canvas)):
block = Block(Point(x, y), 'red')
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
I haven't tried this exercise myself, but think that all your code will only create block objects and then do nothing with them. What you probably want is random numbers picked from each range, up to the number of points you require, with those blocks in an array? Something like:
randomPoints = 4
blocks = 
for dummy in range(randomPoints):
self.block_list[random.randrange(len(self.block_list)] = # whatever a red point is
... or something like that, this would randomly select 4 points, say and set them to red.
Hope this helps