I am a AP Comp Sci student and we have been given an assignment to code karel the robot to climb over a few hurdles I put the code:
private void ascendHurdle(){
r.turnLeft();
while (rightIsBlocked()) {
r.move();
}
r.turnRight();
}
it says that rightIsBlocked is undefined for the type however on the documentation it says that it is a valid command https://www.cs.mtsu.edu/~untch/karel/selection.html <--- the documentation I used Please help
I'd assume that
ris the object that represents your robot. Although it's not very clear based on the documentation,rightIsBlocked()is probably not static, so you'd have to user.rightIsBlocked()(becauseris your instance of the robot's class).I could be wrong, but hopefully this helps.