safineh

80
reputation
9
/* Program of Life */
using World;
using System.Collections.Generic;

public class Me(Person) {
  public static void Main() {
    Trusted = new Resources({World.GOD, getMother(), getFather()});
    Knowledge = new Data();
    Actions = new List<Log>();

    while (!isDead) {
      // basic learn
      Knowledge.Add(Trusted.Learn());

      // input
      var env = getEnvironment();
      var people = env.Find<People>();

      // think
      var understand = Think(env.getObservation() + people?.getActions());
      Actions.Add("think", understand.value / getIQ());

      // output
      var act = Act(understand);
      var react = React(understand);
      var experience = act.getFeedBack() + react.getFeedback();
      Actions.Add("action", act.value / understand.value);
      Actions.Add("action", react.value / understand.value);

      // analyze
      var analyze = Knowledge.Analyze(understand, experience);
      Actions.Add("analyze", analyze.value / understand.value);

      // level up
      Trusted.Add(analyze.getTrusted(True));
      Trusted.Remove(analyze.getTrusted(False));
      Knowledge.Add(analyze.getData(True));
      Knowledge.Remove(analyze.getData(False));
 
      // charging for next iterate
      var needFood = Body.getHungry();
      var eat = Body.Eat();
      var sleep = Body.Sleep();
      Body.Charge(Max(eat.energy, needFood) + Max(sleep.hours, 7.5f / 24));

      Actions.Add("efficiency", 1 - eat.amount / (needFood * 0.9f));
      Actions.Add("efficiency", 1 - sleep.hours / 24);
    }

    setScore(World.GOD.Jaudge(Actions));
  }
}