Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1666f193
Commit
1666f193
authored
Jun 25, 2009
by
R. David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 6340: update by Gregor Lingl of his tdemo_chaos demo program.
Functionally equivalent, clearer code, English comments.
parent
5c3d40e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
27 deletions
+23
-27
Demo/turtle/tdemo_chaos.py
Demo/turtle/tdemo_chaos.py
+23
-27
No files found.
Demo/turtle/tdemo_chaos.py
View file @
1666f193
#
Datei: chaosplotter
.py
# Autor: Gregor Lingl
# Dat
um: 31. 5. 2008
#
File: tdemo_chaos
.py
# Aut
h
or: Gregor Lingl
# Dat
e: 2009-06-24
#
Ein einfaches Programm zur Demonstration von "chaotischem Verhalten".
#
A demonstration of chaos
from
turtle
import
*
N
=
80
def
f
(
x
):
return
3.9
*
x
*
(
1
-
x
)
...
...
@@ -15,47 +17,41 @@ def g(x):
def
h
(
x
):
return
3.9
*
x
-
3.9
*
x
*
x
def
coosys
():
penup
()
goto
(
-
1
,
0
)
pendown
()
goto
(
n
+
1
,
0
)
penup
()
goto
(
0
,
-
0.1
)
def
jumpto
(
x
,
y
):
penup
();
goto
(
x
,
y
)
def
line
(
x1
,
y1
,
x2
,
y2
):
jumpto
(
x1
,
y1
)
pendown
()
goto
(
-
0.1
,
1.1
)
goto
(
x2
,
y2
)
def
plot
(
fun
,
start
,
farbe
):
def
coosys
():
line
(
-
1
,
0
,
N
+
1
,
0
)
line
(
0
,
-
0.1
,
0
,
1.1
)
def
plot
(
fun
,
start
,
colour
):
pencolor
(
colour
)
x
=
start
pencolor
(
farbe
)
penup
()
goto
(
0
,
x
)
jumpto
(
0
,
x
)
pendown
()
dot
(
5
)
for
i
in
range
(
n
):
for
i
in
range
(
N
):
x
=
fun
(
x
)
goto
(
i
+
1
,
x
)
dot
(
5
)
def
main
():
global
n
n
=
80
ox
=-
250.0
oy
=-
150.0
ex
=
-
2.0
*
ox
/
n
ey
=
300.0
reset
()
setworldcoordinates
(
-
1.0
,
-
0.1
,
n
+
1
,
1.1
)
setworldcoordinates
(
-
1.0
,
-
0.1
,
N
+
1
,
1.1
)
speed
(
0
)
hideturtle
()
coosys
()
plot
(
f
,
0.35
,
"blue"
)
plot
(
g
,
0.35
,
"green"
)
plot
(
h
,
0.35
,
"red"
)
# Now zoom in:
for
s
in
range
(
100
):
setworldcoordinates
(
0.5
*
s
,
-
0.1
,
n
+
1
,
1.1
)
setworldcoordinates
(
0.5
*
s
,
-
0.1
,
N
+
1
,
1.1
)
return
"Done!"
if
__name__
==
"__main__"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment