Animal Habitat Simulation
Programming Project 7 - Porcupine.java * Description: This class creates a "Bee" creature that stings from behind while flying around randomly creating "hives" * * This class is supposed to simulate one of the cutest and dangerous animals out there; the porcupine. * The idea behind this class was to simply create something that infected from all sides and didn't move much. This stemmed from the * fly trap idea that won the "game" every time. All in all I wanted something that had defenses from all sides and did not concern * itself with speed or fancy movements, but that kept out of the war zones and was only acting in defence. There for, I made it inect * from all sides and simply move forwards until it hit a wall. This is supposed to seem like a little porcupine walking around for food * until it reaches the end of its habitat and decides to look else were. This class is short, sweet, and to the POINT with simple movements. */method returns the symbol that will represent the creature in the terminal.return is the char symbol that will show up on the screen in the simulation. The Critter interface specifies the two methods a class must // implement to be able to participate in the critter simulation // // 1) getChar()should return a character that will be used for // displaying the Critter in the window, and the // // 2) getMove method should return a legal move given the current neighbors. // // The move should be specified using Move.HOP, Move.LEFT, Move,RIGHT, // or Move.INFECT. // // The four parameters to getMove specify what neighbors the critter: // These choices are Neighbor.WALL, Neighbor.EMPTY, Neighbor.SAME, or // Neighbor.OTHER CritterMain provides method main for a simple simulation program. // //CS335 students: you are welcome to alter the number of each critter //added to the simulation if you want to experiment with different //scenarios. You will have to add two lines of code that add your //own critters to the simulation.# LandMine - The lazy sun of a gun! // If a critter lies in front, INFECT! Otherwise, INFECT! (Turn if it's a wall.) // // Extends the Critter interface, defining the getChar and getMove methods. Rover - The Termites of CritterLand! // If a critter lies in front, INFECT! If it can move forward, hop, // otherwise randomly move right or left. // // Extends the Critter interface, defining the getChar and getMove methods.
You'll get a 28.8KB .RAR file.