Parent Directory
|
Revision Log
Initial revision
| 1 | teddy | 1.1 | #!/usr/bin/python |
| 2 | |||
| 3 | import random | ||
| 4 | |||
| 5 | point = (0,0) | ||
| 6 | |||
| 7 | triangel = [(285,494), (0,0), (570,0)] | ||
| 8 | |||
| 9 | def nextpos(pos): | ||
| 10 | (cornerx, cornery)= random.choice(triangel) | ||
| 11 | (currentx, currenty)= pos | ||
| 12 | return ((cornerx-currentx)/2+currentx,(cornery-currenty)/2+currenty) | ||
| 13 | |||
| 14 | def plot(pos): | ||
| 15 | (xpos, ypos) = pos | ||
| 16 | print "p", xpos, ypos | ||
| 17 | |||
| 18 | print "#PLOT 2" | ||
| 19 | print "o" | ||
| 20 | |||
| 21 | for i in range(100000): | ||
| 22 | point = nextpos(point) | ||
| 23 | plot(point) | ||
| 24 | |||
| 25 | print "x" |
| root@recompile.se | ViewVC Help |
| Powered by ViewVC 1.1.26 |