Ejemplo n.º 1
0
    void Explode()
    {
        Driver   best_time_obj = GameObject.Find("Floor").GetComponent <Driver>();
        TyroData data          = GetComponent <TyroData>();

        float average_score = total_score / total_times_scored;

        if (average_score < data.current_tdata.best_score)//(data.current_tdata.best_time - (data.current_tdata.best_time * .3f) < Time.time - start_time)
        {
            //Debug.Log("New Best Time! \nOld Time: " + data.current_tdata.best_time + "   -   New Time: " + (Time.time - start_time));
            Debug.Log("######### New best score: " + average_score + " - Old: " + data.current_tdata.best_score);
            data.current_tdata.best_time  = (Time.time - start_time);
            data.current_tdata.best_score = average_score;
            // Destroy the visualization for that car so they don't stack

            data.Save();
        }
        else
        {
            Debug.Log("Score: " + average_score);
            //current_tdata.current_tdata.best_time = (current_tdata.current_tdata.best_time * 10 + Time.time - start_time) / 11 ;
        }

        foreach (GameObject data_point in GameObject.FindGameObjectsWithTag("Datapoint"))
        {
            Destroy(data_point);
        }
        Destroy(this.gameObject);
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        learner = new OrdinaryLeastSquares()
        {
            UseIntercept = true
        };

        data = GetComponent <TyroData>();
        car  = GetComponent <CarMovement>();

        // Now, we can use the learner to finally estimate our model:
        if (Time.time > 10)
        {
            data.Mutate();
        }
        regression = learner.Learn(data.current_tdata.input.ToArray(), data.current_tdata.output.ToArray());
    }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     action = "Nothing";
     data   = GetComponent <TyroData>();
 }