KnightBug |
Create a new project named KnightBugRunner. In your client KnightBugRunner class, write a main method that tests one or more KnightBug's so that the instructor can easily grade the project. Place Rocks and other Actors to give evidence that the KnightBug(s) demonstrate the following behavior. You may want to watch this video for the JumpingBug demo program. JumpingBug is based on the Jumper class that is found in the Student Manual Narrative. Write a KnightBug class (in the same KnightBugRunner file) that makes a KnightBug move like a knight in chess. A KnightBug should always move two squares in the direction that it is pointed and then one square to the right hopping over any actors that may be in those squares. When the KnightBug successfully moves to a new square, it's new direction should be ninety degrees clockwise from its old direction which means that it is turning "to the right." If there is any kind of Actor other than a Flower in the square where it will be landing, then the KnightBug must turn 45 degrees to the right like a normal Bug instead of moving to the new square. Like Bugs, KnightBugs should leave flowers behind in the squares where they land. See the instructor ASAP if you are not clear on any part of the description above. Your program must follow our class Coding Standards You must hand in the following on separate pages stapled in this specified order:
|