All pastes #164661 Raw Edit

Logi

public java v1 · immutable
·published 2006-09-08 20:50 UTC
rendered paste body
import becker.robots.*;class WriterBot extends RobotSE {        public WriterBot(City aCity, int aStreet, int anAvenue, Direction aDirection, int numThings){                super(aCity, aStreet, anAvenue, aDirection, numThings);        }        void uRight(){                this.turnRight();                this.move();                this.turnRight();        }        void uRight(int howWide){                this.turnRight();                this.move(howWide);                this.turnRight();        }        void uLeft(){                this.turnLeft();                this.move();                this.turnLeft();        }        void uLeft(int howWide){                this.turnLeft();                this.move(howWide);                this.turnLeft();        }        void moveBack(){                this.move();                this.turnLeft();                this.move(4);                this.turnRight();                this.move();        }        void writeLine(int[] inputLine){                for (int i = 0; i < inputLine.length; i++){                        if ((inputLine[i] == 1) && (i == 4)) {                                this.putThing();                        }                        else if ((inputLine[i] == 1) && (i < 4)){                                this.putThing();                                this.move();                        }                        else if ((inputLine[i] == 0) && (i < 4)){                                this.move();                        }                        else continue;                }        }        void writeLetter(char letter){                int selectedLetter = ((int) letter) - 'A';                                int letterGridMatrix[][][] = {                        {{0,1,1,1,0}, {1,0,0,0,1}, {1,1,1,1,1}, {1,0,0,0,1}, {1,0,0,0,1}},                        {{1,1,1,1,0}, {1,0,0,0,1}, {1,1,1,1,0}, {1,0,0,0,1}, {1,1,1,1,0}},                        {{1,1,1,1,1}, {1,0,0,0,0}, {1,0,0,0,0}, {1,0,0,0,0}, {1,1,1,1,1}},                        {{1,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {1,0,0,0,1}, {1,1,1,1,0}},                        {{1,1,1,1,1}, {1,0,0,0,0}, {1,1,1,1,0}, {1,0,0,0,0}, {1,1,1,1,1}}                };                                this.writeLine(letterGridMatrix[selectedLetter][0]);                this.uRight();                this.writeLine(letterGridMatrix[selectedLetter][1]);                this.uLeft();                this.writeLine(letterGridMatrix[selectedLetter][2]);                this.uRight();                this.writeLine(letterGridMatrix[selectedLetter][3]);                this.uLeft();                this.writeLine(letterGridMatrix[selectedLetter][4]);                this.moveBack();        }}public class test {        public static void main(String args[]){                City columbia = new City();                WriterBot robot1 = new WriterBot(columbia, 0, 0, Direction.EAST, 50);                                robot1.writeLetter('A');                robot1.writeLetter('B');        }}