// Use this for initialization
    void Start()
    {
        Vector3 size = GameObject.Find("FlatEarth").GetComponent <Renderer>().bounds.size;

        step = 10;
        int arraySize = (int)Mathf.Floor((float)(size.x / step));

        map = new float[arraySize, arraySize];

        for (int i = 0; i < arraySize; i++)
        {
            for (int j = 0; j < arraySize; j++)
            {
                Ray ray = new Ray(new Vector3((i * step) - arraySize / 2, 0f, (j * step) - arraySize / 2), new Vector3(0, -1, 0));
                // create a plane at 0,0,0 whose normal points to +Y:
                Collider planeCollider = GameObject.Find("FlatEarth").GetComponent <Collider>();

                // Plane.Raycast stores the distance from ray.origin to the hit point in this variable:
                RaycastHit distance = new RaycastHit();
                // if the ray hits the plane...
                if (planeCollider.Raycast(ray, out distance, 200f))
                {
                    map[i, j] = -distance.point.y;
                }
                else
                {
                    map[i, j] = -1;
                }
            }
        }
        HousePlacement.PlaceHouses(new float[arraySize, arraySize]);
    }
 // Update is called once per frame
 void Update()
 {
     if (MoonMovement.WaterLvl == null)
     {
         return;
     }
     if (initPopulation)
     {
         for (int i = 0; i <= Mathf.Max(phi, tau); i++)
         {
             population.Add(new float[MoonMovement.WaterLvl.GetLength(0), MoonMovement.WaterLvl.GetLength(1)]);
         }
         initPopulation = false;
     }
     float[,] k = MoonMovement.WaterLvl;
     //Debug.Log (k[0,0]);
     float[,] n     = (float[, ])population[population.Count - 1];
     float[,] n_phi = (float[, ])population[population.Count - 1 - phi];
     float[,] n_tau = (float[, ])population[population.Count - 1 - tau];
     float[,] current_population = update_population(k, n, n_phi, n_tau);
     population.Add(current_population);
     HousePlacement.PlaceHouses(current_population);
     while (population.Count > (Mathf.Max(phi, tau) + 1))
     {
         population.RemoveAt(0);
     }
 }