Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
54 views

MR - MAMPAN SANGSA 50052523 The Karel 1)

import stanford.karel.Karel; /** * */ /** * @author Administrator * */ public class GrandFatherKarel extends Karel { /** * @param args */ public void run() { move(); turnLeft(); move(); turnLeft(); turnLeft(); turnLeft(); move(); pickBeeper(); turnLeft(); move(); turnLeft(); turnLeft(); turnLeft(); move(); move(); putBeeper(); turnLeft(); move(); move(); turnLeft(); while (frontIsClear()) { move(); } turnLeft(); while (frontIsClear()) { move(); } t

Uploaded by

Bank
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

MR - MAMPAN SANGSA 50052523 The Karel 1)

import stanford.karel.Karel; /** * */ /** * @author Administrator * */ public class GrandFatherKarel extends Karel { /** * @param args */ public void run() { move(); turnLeft(); move(); turnLeft(); turnLeft(); turnLeft(); move(); pickBeeper(); turnLeft(); move(); turnLeft(); turnLeft(); turnLeft(); move(); move(); putBeeper(); turnLeft(); move(); move(); turnLeft(); while (frontIsClear()) { move(); } turnLeft(); while (frontIsClear()) { move(); } t

Uploaded by

Bank
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

MR.

MAMPAN SANGSA 50052523

The Karel

1)

import stanford.karel.Karel;

/**

*/

/**
* @author Administrator

*/

public class GrandFatherKarel extends Karel {

/**

* @param args

*/

public void run() {

move();

turnLeft();

move();

turnLeft();

turnLeft();

turnLeft();

move();

pickBeeper();

turnLeft();

move();

turnLeft();
turnLeft();

turnLeft();

move();

move();

putBeeper();

turnLeft();

move();

move();

turnLeft();

while (frontIsClear()) {

move();

turnLeft();

while (frontIsClear()) {

move();

turnLeft();

}
}

2)
import stanford.karel.Karel;

/**

*/

/**

* @author Administrator

*/
public class ConditionKarel extends Karel {

/**

* @param args

*/

public void run() {

move();

move();

turnLeft();

turnLeft();

turnLeft();

move();

pickBeeper();

turnLeft();

turnLeft();

move();

move();

turnLeft();

turnLeft();

turnLeft();
move();

move();

move();

move();

turnLeft();

turnLeft();

turnLeft();

move();

pickBeeper();

turnLeft();

turnLeft();

move();

turnLeft();

turnLeft();

turnLeft();

move();

turnLeft();

turnLeft();

while (frontIsClear()) {

move();
}

turnLeft();

move();

turnLeft();

3)
import stanford.karel.Karel;

/**

*/

/**

* @author Administrator

*/
public class SecondKarel extends Karel {

/**

* @param args

*/

public void run() {

turnLeft();

move();

turnLeft();

turnLeft();

turnLeft();

move();

move();

pickBeeper();

turnLeft();

move();

turnLeft();

turnLeft();

turnLeft();

move();
pickBeeper();

turnLeft();

move();

turnLeft();

turnLeft();

turnLeft();

move();

move();

turnLeft();

turnLeft();

turnLeft();

move();

move();

move();

pickBeeper();

turnLeft();

turnLeft();

move();

move();

move();
turnLeft();

turnLeft();

turnLeft();

move();

turnLeft();

turnLeft();

while (frontIsClear()) {

move();

turnLeft();

move();

move();

move();

turnLeft();

}
4)
import stanford.karel.Karel;

/**

*/

/**

* @author Administrator

*/

public class MethodKarel extends Karel {

/**

* @param args

*/

public void run() {

move();

turnLeft();

turnLeft();

turnLeft();
move();

pickBeeper();

turnLeft();

turnLeft();

move();

turnLeft();

turnLeft();

turnLeft();

move();

turnLeft();

move();

turnLeft();

turnLeft();

turnLeft();

move();

move();

turnLeft();

turnLeft();

turnLeft();

move();
move();

pickBeeper();

turnLeft();

turnLeft();

move();

turnLeft();

turnLeft();

turnLeft();

move();

turnLeft();

move();

turnLeft();

turnLeft();

turnLeft();

move();

turnLeft();

turnLeft();

while (frontIsClear()) {

move();

}
turnLeft();

move();

turnLeft();

5)
import stanford.karel.Karel;

/**

*/

/**

* @author Administrator

*/
public class GrandFatherKarel extends Karel {

/**

* @param args

*/

public void run() {

move();

move();

turnLeft();

turnLeft();

turnLeft();

move();

pickBeeper();

turnLeft();

turnLeft();

move();

move();

turnLeft();

turnLeft();

turnLeft();
move();

move();

move();

turnLeft();

turnLeft();

turnLeft();

move();

pickBeeper();

turnLeft();

turnLeft();

move();

turnLeft();

turnLeft();

turnLeft();

move();

turnLeft();

move();

turnLeft();

turnLeft();

turnLeft();
move();

turnLeft();

move();

turnLeft();

while (frontIsClear()) {

move();

turnLeft();

while (frontIsClear()) {

move();

turnLeft();

You might also like