Difference between revisions of "CSC111 Homework 11 solution program"
(→Source) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
--[[User:Thiebaut|D. Thiebaut]] 12:22, 28 April 2010 (UTC) | --[[User:Thiebaut|D. Thiebaut]] 12:22, 28 April 2010 (UTC) | ||
---- | ---- | ||
− | + | <onlydft> | |
==Zip file== | ==Zip file== | ||
The program and all the gif files associated with it can be found in this [[Media:CSC111_hw11_solution.zip | zip file]]. | The program and all the gif files associated with it can be found in this [[Media:CSC111_hw11_solution.zip | zip file]]. | ||
Line 132: | Line 132: | ||
def swim(self): | def swim(self): | ||
"""moves the fish horizontally and randomly up and down""" | """moves the fish horizontally and randomly up and down""" | ||
− | ddy = [-3, -2, -1 | + | ddy = [-3, -2, -1, 1, 2, 3] + 15*[0] |
index = randrange(len(ddy)) | index = randrange(len(ddy)) | ||
if self.d: | if self.d: | ||
Line 232: | Line 232: | ||
</source> | </source> | ||
− | + | </onlydft> | |
<br /> | <br /> | ||
<br /> | <br /> |