Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Challenges;
- import kareltherobot.Robot;
- import kareltherobot.World;
- public class EsperBot2 extends Robot {
- public EsperBot2(int street, int avenue, Direction direction, int beeperCount) {
- super(street, avenue, direction, beeperCount);
- }
- public static void main(String[] args) {
- World.setDelay(50);
- World.setVisible();
- World.setSize(10, 10);
- World.showSpeedControl(true);
- Lesson3.Activity1 zgod = new Lesson3.Activity1(1, 3, North, -1);
- }
- /**
- * Turns right
- * @return void
- */
- public void turnRight() {
- int del = World.delay();
- World.setDelay(0);
- turnLeft();
- turnLeft();
- World.setDelay(del);
- turnLeft();
- }
- /**
- * Turns right
- * @return boolean
- */
- boolean RETwallonright = true;
- public boolean wallOnRight(){
- int del = World.delay();
- World.setDelay(0);
- turnRight();
- if (frontIsClear()) { // checks if there is a wall when it turns right
- RETwallonright = false;
- }else {
- RETwallonright = true;
- }
- World.setDelay(del);
- turnLeft();
- return RETwallonright;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement