All pastes #179418 Raw Edit

Logi

public java v1 · immutable
#179418 ·published 2006-09-22 06:04 UTC
rendered paste body
import becker.robots.*;class castleBuilder extends City {        public castleBuilder(){                super();        }        public void buildCastle(){                this.placeColumn(1, 1);                this.placeColumn(1, 4);                this.placeColumn(4, 1);                this.placeColumn(4, 4);                this.buildCenter();        }        private void placeColumn(int aStreet, int anAvenue){                Wall w0 = new Wall(this, aStreet, anAvenue, Direction.NORTH);                Wall w1 = new Wall(this, aStreet, anAvenue, Direction.SOUTH);                Wall w2 = new Wall(this, aStreet, anAvenue, Direction.EAST);                Wall w3 = new Wall(this, aStreet, anAvenue, Direction.WEST);        }        private void buildCenter(){                Wall w0 = new Wall(this, 2, 2, Direction.NORTH);                Wall w1 = new Wall(this, 2, 2, Direction.WEST);                Wall w2 = new Wall(this, 2, 3, Direction.NORTH);                Wall w3 = new Wall(this, 2, 3, Direction.EAST);                Wall w4 = new Wall(this, 3, 2, Direction.SOUTH);                Wall w5 = new Wall(this, 3, 2, Direction.WEST);                Wall w6 = new Wall(this, 3, 3, Direction.SOUTH);                Wall w7 = new Wall(this, 3, 3, Direction.EAST);        }}class guardBot extends RobotSE {        public guardBot(City aCity, int aStreet, int anAvenue, Direction aDirection){                super(aCity, aStreet, anAvenue, aDirection);        }        public void guard(){                this.moveAroundColumn();                this.move();                this.moveAroundColumn();                this.move();                this.moveAroundColumn();                this.move();                this.moveAroundColumn();                this.move();        }        private void moveAroundColumn(){                this.turnLeft();                this.move();                this.turnRight();                this.move(2);                this.turnRight();                this.move(2);                this.turnRight();                this.move();                this.turnLeft();        }}public class HomeworkLab3 {        public static void main(String args[]){                castleBuilder c = new castleBuilder();                guardBot r = new guardBot(c, 2, 1, Direction.NORTH);                                c.buildCastle();                r.guard();                        }}