/[cvs]/fract/sierpinski.py
ViewVC logotype

Contents of /fract/sierpinski.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Sat Feb 24 15:57:15 2001 UTC (23 years, 8 months ago) by teddy
Branch: masse, MAIN
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/x-python
Error occurred while calculating annotation data.
Imported sources (take 2)

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