파이썬이고요 원소블록의 번호에 따른 블럭 재정렬 코딩 작성중입니다.(선택정렬)
분명 블록 랜덤셋팅과 교체하며 정렬하는 것 이렇게 두개가 함수 두개 아닌가요?
지금 두시간째 들여다 보고 있는데 대체 왜 함수가 하나만 있다 나오는지 모르겠어 질문 드립니다..

bloc = 11
def agent_home():
player.teleport(world(-2, -60, 8))
agent.teleport_to_player()
agent.move(FORWARD, 4)
def base_loc():
agent.move(FARMLAND, 5)
agent.move(LEFT, bloc // 2)
def set_blocks():
agent_home()
for i in range(20):
agent.set_item(523 + i, 1, 1+i)
base_loc()
slot = []
i = 0
while i < bloc:
j = 0
slot[i] = randint(1, 20)
if i:
for j in range(i):
if slot[i] == slot[j]:
break
if i == j:
agent.set_slot(slot[i])
loops.pause(250)
if agent.detect(AgentDetection.BLOCK, FORWARD):
agent.destroy(FORWARD)
agent.place(FORWARD)
if i < bloc - 1:
agent.move(RIGHT, 1)
i += 1
agent.move(LEFT, bloc // 2)
agent.move(BACK, 5)
player.on_chat("set", set_blocks)
def destroy_blocks():
agent_home()
base_loc()
for i in range(bloc):
if agent.detect(AgentDetection.BLOCK, FORWARD):
agent.destroy(FORWARD)
if i < bloc - 1:
agent.move(RIGHT,1)
agent.move(UP, 1)
for i in range(bloc):
if agent.detect(AgentDetection.BLOCK, FORWARD):
agent.destroy(FORWARD)
if i < bloc - 1:
agent.move(LEFT,1)
agent.move(DOWN, 1)
agent.move(RIGHT, bloc // 2)
agent.move(BACK, 5)
player.on_chat("clean", destroy_blocks)
def sort_blocks():
base_loc()
for i in range (bloc - 1):
loc = i
min_new = agent.inspect(AgentInspection.BLOCK, FORWARD)
agent.set_item(min_new, 1, 26)
for j in range(i+1,bloc):
agent.move(RIGHT, 1)
min_j = agent.inspect(AgentInspection.BLOCK, FORWARD)
if min_new > min_j:
min_new = min_j
loc = j
if i != loc:
agent.move(LEFT, bloc - loc - 1)
if agent.detect(AgentDetection.BLOCK, FORWARD):
agent.destroy(FORWARD)
agent.set_slot(26)
agent.place(FORWARD)
agent.move(LEFT, loc - i)
agent.set_item(min_new, 1, 27)
agent.set_slot(27)
if agent.detect(AgentDetection.BLOCK, FORWARD):
agent.destroy(FORWARD)
agent.place(FORWARD)
else:
agent.move(LEFT, bloc - i - 1)
agent.move(RIGHT, 1)
player.on_chat("sort", sort_blocks)
맨 마지막 줄에 챗 에서 오류가 나옵니다