Hello,
I am a first year programming student and I got problem solving an exercice I would be glad if you could help me.
Write a program, Tut6_2.cs where robby walks around the perimeter of room 8, avoiding blue obstacles. In room 8, the obstacles are all one square wide (again), but of varied length.
Your solution should use while loops to negotiate these obstacles
I attached a picture of the room 8.The problem I encounter is when the robot go up the obstacle I don t know how he can check at his right.Code:namespace CE0721a { classtut6_2 { publicvoid run() { // make objects Robot robby = new Robot(); Room room = new Room(8); Picture picture = new Picture(room, robby); robby.right(); picture.draw(); while (true) { if (robby.ahead_is_colour(room, "white")) { robby.move(); picture.draw(); if (robby.ahead_is_colour(room, "blue")) { robby.left(); picture.draw(); } if (robby.ahead_is_colour(room, "black")) { robby.left(); picture.draw(); } } } } } }
Thank you in advance for your help
best regards
Thibault[ATTACH]11093[/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT]