I'm currently working on a program that's essentially a simple walking random thing in a maze, and I need to make sure that it acts certain ways if it doesn't walk out of the maze, but comes into contact with the colors red, black and blue. Here's my code so far:
[url]http://pastebin.com/VKLNuedC[/url]
[quote]
else:
color= getColor(robot,x,y)
if color= black:
x=xOld
y=yOld
elif color= red:
boom=1
elif color= blue:
beamedup=1
[/quote]
Here's where I'm having problems, JES is flagging up my if color=black: statement, which is preventing the program from even loading.
Am I missing something really basic? Should I be putting down the RGB values? JES recognizes colors by name if you have them but it doesn't seem to be legal Jython.
Need to be using == for comparison. = is just for value setting
[QUOTE=dmillerw;44309896]Need to be using == for comparison. = is just for value setting[/QUOTE]
Yeah, fixed that, so now I'm encountering another problem.
On line 19, it's flagging up that robot = getPixel(maze, x, y)
The error was:
Inappropriate argument value (of correct type).
An error occurred attempting to pass an argument to a function.
It also draws the maze and starts drawing the line, but it doesn't care if it crosses through anything, and as soon as it reaches the boundary it highlights line 19 as an error.
Sorry, you need to Log In to post a reply to this thread.