@Override
	public void endOfTurn()
	{
		activePlayer = (++activePlayer) % playersInGame.size();
		if(activePlayer == 0)
		{
			//all players has had their turn
			
			/*
			 * A) restore all units' move counts
			 * B) produce food and production in all cities
			 * C) produce units in all cities (if enough production)
			 * D) increase population size in all cities (if enough food)
			   * E) increment the world age.
			 */
			
			//A
			for(int i=0; i<GameConstants.WORLDSIZE; i++){
				for(int n=0; n<GameConstants.WORLDSIZE; n++){
					Position p = new Position(i, n);
					if(world.getUnitAt(p) != null){
						world.getUnitAt(p).setMoveCount(1);
					}
				}
			}
			//B + C
			for (int i = 0; i < world.getMapHeight(); i++) 
			{
				for (int j = 0; j < world.getMapWidth(); j++)
				{
					Position p = new Position(i, j);
					if(getCityAt(p) != null)
					{
						CityImpl c = (CityImpl) getCityAt(p);
						c.increaseProductionAmount(6);
						
						if(c.hasFinishedProduction())
						{
							Position spawnPos = getPositionForProducedUnit(p);		
							if(spawnPos != null)
							{
								//no room for unit, ignore
								createUnit(spawnPos, c.getProduction(), c.getOwner());
							}					
						}						
					}
				}
			}
			
			
			//E
			gameAge = ageStrategy.calculateTime(gameAge);
		}
		

		for(GameObserver o : observers)
		{
			o.turnEnds(getPlayerInTurn(), getAge());
		}
	}