示例#1
1
	public void reset() {
		// All bugs energy 10
		for (int i = 0; i < bugs.size(); i++)
			bugs.get(i).setEnergy(10);

		// Regenerate map
		map.generate(map.getXSize(), map.getYSize());
	}
示例#2
0
	/**
	 * Gets a random space on the map that is open space
	 * 
	 * @return Random empty coordinates
	 * @author Alex
	 */
	public Point getUnoccupiedPosition() {
		Point position = new Point();

		// Do while empty space not found
		do {
			position.x = random.nextInt(map.getXSize());
			position.y = random.nextInt(map.getYSize());
		} while (map.getCells()[position.y].toCharArray()[position.x] != ' ' && !isBugAtPosition(position));

		return position;
	}