- 指定位置正方形方阵
大家帮忙看一下 为什么错了
- 2023-7-11 21:50:05 @
from wonderLang import *
def Square(x,y,length):
i = 1
jump(x, y)
while i<=4:
forward(length)
right(90)
i+=1
def square_square(x,y,space,length,n,m):
temp1 = x
temp2 = m
for n in range(0,n):
# 每次调用前将x和m恢复成最初状态
x = temp1
m = temp2
# 题目最后一个正方形是在右下角所以是y值是向下的
y -= length + space
for m in range(0,m):
Square(x, y, length)
x += length + space
if n!=2&m!=2:
jump(x, y)
square_square(0, 0, 10, 30, 3, 3)
3 条评论
-
刘佳言 LV 4 @ 2023-8-28 13:14:01
from wonderLang import *
def square(x,y,l): jump(x,y) angle = 90 i = 0 while i < 4: forward(l) right(angle) i = i + 1 def square_line(x,y,n,space,len): i=0 while i < n: square(x,y,len) x = x + len + space i = i+1 def square_square(x,y,space,len,n,m): i = 0 while i < m: square_line(x,y,n,space,len) y = y - len - space i = i + 1
square_square(0,0,10,30,3,3)
-
2023-8-28 11:30:17@
def square(x, y, length): jump(x,y) i=0 while i<4: forward(length) right(90) i = i+1
def square_line(x, y, n, space, len): i=0 while i<n: square(x,y,len) x=x+len+space i=i+1
def square_square(x, y, space, length, n, m): i=0 while i<m: square_line(x, y, n, space, length) y=y-length-space i=i+1 square_square(0,0,10,30,3,3)
-
2023-7-27 14:24:26@
可能是函数多余了,一个就够了。
- 1
信息
- ID
- 49
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- 递交数
- 2805
- 已通过
- 741
- 上传者