I'm stumped. I've ran this with a least 100 little changes and I can't figure out why I keep going out of range (and yes, Grim Archon, I have been doing my reading
). This uses a robot class that isn't published, so I don't know if anyone can help me by just looking at the syntax? This is the pertinent code I have, and what I get when I run it (please excuse the scaffolding):
direction=[N,W,E,S] #4 robot directions possible/scannable
xN,yN=r.sensor(N) #objects and how far away they are
for (i) in objlist:
#print type (m)
for j in range(m): <--m is type 'int', m=2
I figured this would work just like any other time I've used the range function, but it's not! Notice the j index keeps reinitializing itself to 0 (from the scaffolding):
Traceback (most recent call last):
File "C:\WINDOWS\Desktop\a8backup\samprobot.py", line 27, in ?
r.move(direction[m]) <--m is type 'int', m=2
File "robotlib.py", line 451, in move
RuntimeError: Past edge of board
I know this has to have a simple answer, but I can't find it. If anyone can point me in the right direction I sure would appreciate it!