Untitled

 avatar
unknown
plain_text
2 months ago
511 B
4
Indexable
/*
 * This code implements Frogs, which move randomly by 3 squares according to a random number generator.
 */


public class Frog implements Critter {
	public char getChar() {
		return 'F';
	}
	public int getMove(CritterInfo info) {
		int random = (int) (Math.random() * (4));
		if (random == 0) {
			return NORTH;
		}
		if (random == 1) {
			return SOUTH;
		}
		if (random == 2) {
			return EAST;
		}
		if (random == 3) {
			return WEST;
		}
		else {
			return CENTER;
		}
	}
	
}
Editor is loading...
Leave a Comment