Esempio n. 1
0
    public double getFitness()
    {
        double d = (((cumulativeDistanceFromTarget / (double)limbCount)
                     + fuelUsed + stillnessValue + slownessValue + angularVelValue)
                    / (double)lifetime)
                   * (double)Mathf.Pow(Config.ORB_MULTIPLIER, (float)orbsCollected)
                   * (double)Mathf.Pow(Config.BLOAT_MULTIPLIER, rootNode.engineCount());

        if (d < 0)
        {
            Debug.Log((cumulativeDistanceFromTarget / (double)limbCount));
            Debug.Log(fuelUsed);
            Debug.Log(stillnessValue);
            Debug.Log(slownessValue);
            Debug.Log(angularVelValue);
        }
        return(d);
    }
Esempio n. 2
0
    public int engineCount()
    {
        int engines = isEngine ? 1 : 0;

        if (top != null && parentPos != ChildNode.TOP)
        {
            engines += top.engineCount();
        }
        if (bottom != null && parentPos != ChildNode.BOTTOM)
        {
            engines += bottom.engineCount();
        }
        if (left != null && parentPos != ChildNode.LEFT)
        {
            engines += left.engineCount();
        }
        if (right != null && parentPos != ChildNode.RIGHT)
        {
            engines += right.engineCount();
        }

        return(engines);
    }