public boolean randomFlower()
	{
		Grid<Actor> gr = getGrid();
		ArrayList<Location> loc = new ArrayList<Location>();
		loc = gr.getOccupiedLocations();
		
		int row = (int)(Math.random() * 19);
		int col = (int)(Math.random() * 19);
		Location new1 = new Location(row, col);
		
		
		
		boolean existent = false;
		// if i is less than size of occupied locations
		for (int i = 0; i < loc.size(); i++);
		// if i is equal to number of flowers
			if(gr.get(loc.get(i)) instanceof Flower)
				existent = true;
		if(existent = false)
		{
			if(gr.get(new1) != null)
			{
				randomFlower();
			}
			else
			{
				Flower flower = new Flower();
				flower.putSelfInGrid(gr, new1);
			}
		}
		return true;
	}

Title is self explanatory, Im getting an error cannot find symbol variable i

Recommended Answers

All 2 Replies

That semi-colon ( ; ) at the end of your for statement ends the for loop.

Please show full text of error message here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.