Я скачал python на телефон и написал эту программу:
import turtle as t
t.speed(1)
a = 50
Moves = [1]
Coords_rn = 1
for p in range(5):
for o in Moves:
if(o == 1 or 2 or 3):
Moves.append(o+1)
elif(o == 4):
Moves.append(1)
for a in Moves:
if(a == 1 and Coords_rn == 1):
t.forward(10)
elif(a == 2 and Coords_rn == 2):
t.forward(10)
elif(a == 3 and Coords_rn == 3):
t.forward(10)
elif(a == 4 and Coords_rn == 4):
t.forward(10)
elif(a == 1 and Coords_rn == 2):
Coords_rn = 1
t.right(90)
t.forward(10)
elif(a == 1 and Coords_rn == 3):
Coords_rn = 1
t.right(180)
t.forward(10)
elif(a == 1 and Coords_rn == 4):
Coords_rn = 1
t.left(90)
t.forward(10)
elif(a == 2 and Coords_rn == 1):
Coords_rn = 2
t.left(90)
t.forward(10)
elif(a == 2 and Coords_rn == 3):
Coords_rn = 2
t.right(90)
t.forward(10)
elif(a == 2 and Coords_rn == 4):
Coords_rn = 2
t.right(180)
t.forward(10)
elif(a == 3 and Coords_rn == 1):
Coords_rn = 3
t.right(180)
t.forward(10)
elif(a == 3 and Coords_rn == 2):
Coords_rn = 3
t.left(90)
t.forward(10)
elif(a == 3 and Coords_rn == 4):
Coords_rn = 3
t.right(90)
t.forward(10)
elif(a == 4 and Coords_rn == 1):
Coords_rn = 4
t.right(90)
t.forward(10)
elif(a == 4 and Coords_rn == 2):
Coords_rn = 4
t.left(180)
t.forward(10)
elif(a == 4 and Coords_rn == 3):
Coords_rn = 4
t.left(90)
t.forward(10)
Без этой:
for p in range(5):
for o in Moves:
if(o == 1 or 2 or 3):
Moves.append(o+1)
elif(o == 4):
Moves.append(1)
Части всё работает... Но когда я добавляю её в программу черепаха просто... Стоит... Но программа не кончается!
В чём здесь проблема?
import turtle as t
t.speed(1)
a = 50
Moves = [1]
Coords_rn = 1
for p in range(5):
for o in Moves:
if(o == 1 or 2 or 3):
Moves.append(o+1)
elif(o == 4):
Moves.append(1)
for a in Moves:
if(a == 1 and Coords_rn == 1):
t.forward(10)
elif(a == 2 and Coords_rn == 2):
t.forward(10)
elif(a == 3 and Coords_rn == 3):
t.forward(10)
elif(a == 4 and Coords_rn == 4):
t.forward(10)
elif(a == 1 and Coords_rn == 2):
Coords_rn = 1
t.right(90)
t.forward(10)
elif(a == 1 and Coords_rn == 3):
Coords_rn = 1
t.right(180)
t.forward(10)
elif(a == 1 and Coords_rn == 4):
Coords_rn = 1
t.left(90)
t.forward(10)
elif(a == 2 and Coords_rn == 1):
Coords_rn = 2
t.left(90)
t.forward(10)
elif(a == 2 and Coords_rn == 3):
Coords_rn = 2
t.right(90)
t.forward(10)
elif(a == 2 and Coords_rn == 4):
Coords_rn = 2
t.right(180)
t.forward(10)
elif(a == 3 and Coords_rn == 1):
Coords_rn = 3
t.right(180)
t.forward(10)
elif(a == 3 and Coords_rn == 2):
Coords_rn = 3
t.left(90)
t.forward(10)
elif(a == 3 and Coords_rn == 4):
Coords_rn = 3
t.right(90)
t.forward(10)
elif(a == 4 and Coords_rn == 1):
Coords_rn = 4
t.right(90)
t.forward(10)
elif(a == 4 and Coords_rn == 2):
Coords_rn = 4
t.left(180)
t.forward(10)
elif(a == 4 and Coords_rn == 3):
Coords_rn = 4
t.left(90)
t.forward(10)
Без этой:
for p in range(5):
for o in Moves:
if(o == 1 or 2 or 3):
Moves.append(o+1)
elif(o == 4):
Moves.append(1)
Части всё работает... Но когда я добавляю её в программу черепаха просто... Стоит... Но программа не кончается!
В чём здесь проблема?