Commit d4117e3a by BellCodeEditor

save project

parent 704637a7
Showing with 13 additions and 36 deletions
import turtle num_list=[1,3,5,8,11,15,17,18,20,21]
import random num=20
low=0
pen = turtle.Turtle() high=len(num_list)-1
pen.color('sienna') #画笔颜色 while low<=high:
# 画布大小 mid=(low+high)//2
w = turtle.Screen() guss=num_list[mid]
w.bgcolor('wheat') # wheat小麦画布颜色 if guss==num:
print("找到了")
# 移动到起点 elif:guss<num:
def tree(n): low=mid+1
if n>=0:
if n<=12:
color_list=['snow','lightcoral']
color=random.choice(color_list)
pen.color('siema')
pen.pensize(n/3)
else: else:
pen.color('sienna') high=mid-1
pen.pensize(n/10)
pen.forward(n)
al = random.random()
pen.right(30*al)
le =15*random.random()
tree(n-le)
pen.left(60*al)
tree(n-le)
pen.right(30*al)
pen.up()
pen.backward(n)
pen.down()
pen.left(90)
pen.up()
pen.backward(150) # 后退
pen.down()
tree(50)
turtle.done()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment