Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson15-diy3
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a78edcb4
authored
May 14, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
576b5884
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
qwerty.py
qwerty.py
0 → 100644
View file @
a78edcb4
import
turtle
import
random
pen
=
turtle
.
Turtle
()
pen
.
color
(
'sienna'
)
pen
.
speed
(
0
)
# 画布大小
w
=
turtle
.
Screen
()
w
.
bgcolor
(
'wheat'
)
# wheat小麦
def
tree
(
n
):
if
n
>=
0
:
angle
=
random
.
randint
(
15
,
30
)
lenth
=
random
.
randint
(
1
,
25
)
pencolor
=
[
'snow'
,
'lightcoral'
]
tree_lenth
=
n
-
lenth
if
tree_lenth
<
5
:
pen
.
color
(
random
.
choice
(
pencolor
))
pen
.
pensize
(
3
)
else
:
pen
.
pensize
(
n
/
10
)
pen
.
color
(
'sienna'
)
pen
.
forward
(
n
)
#树干
pen
.
right
(
angle
)
#右边树干
tree
(
tree_lenth
)
#右边树枝
pen
.
left
(
2
*
angle
)
#左边树枝
tree
(
tree_lenth
)
#左边树枝
pen
.
right
(
angle
)
#返回起点
pen
.
up
()
#退回起点
pen
.
backward
(
n
)
#退回起点
pen
.
down
()
#退回起点
# 移动到起点
pen
.
left
(
90
)
pen
.
up
()
pen
.
backward
(
150
)
# 后退
pen
.
down
()
tree
(
100
)
turtle
.
done
()
\ No newline at end of file
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