public void MakePlotTest() { CleanTestBase.RunAutomatically(false); var cs = new OxyCalculationSetup(Utili.GetCurrentMethodAndClass()); cs.StartHousehold(1, GlobalConsts.CSVCharacter, configSetter: x => { x.Enable(CalcOption.DesiresLogfile); }); using (FileFactoryAndTracker fft = new FileFactoryAndTracker(cs.DstDir, "1", cs.Wd.InputDataLogger)) { fft.ReadExistingFilesFromSql(); CalculationProfiler cp = new CalculationProfiler(); ChartCreationParameters ccps = new ChartCreationParameters(300, 4000, 2500, false, GlobalConsts.CSVCharacter, new DirectoryInfo(cs.DstDir)); var aeupp = new Desires(ccps, fft, cp); Logger.Info("Making picture"); var di = new DirectoryInfo(cs.DstDir); ResultFileEntry rfe = cs.GetRfeByFilename("Desires.HH1.CHR02 Katee (37 Female).csv"); aeupp.MakePlot(rfe); Logger.Info("finished picture"); //OxyCalculationSetup.CopyImage(resultFileEntries[0].FullFileName); var imagefiles = FileFinder.GetRecursiveFiles(di, "Desires.*.png"); imagefiles.Count.Should().BeGreaterOrEqualTo(1); } cs.CleanUp(); CleanTestBase.RunAutomatically(true); }
private void SetDesire() { int randomNumber = UnityEngine.Random.Range(0, System.Enum.GetValues(typeof(Desires)).Length); desire = (Desires)randomNumber; bubble.SetBubbleText(desire.ToString()); }
/// <summary> /// Generates desires. /// </summary> public void Options() { Desires.Clear(); foreach (var b in Beliefs) { if (b.Name == TypesBelief.PotentialWaterSpots) { var waterPos = b.Predicate as List <Tuple <int, int> >; waterPos.Sort(delegate(Tuple <int, int> tupleA, Tuple <int, int> tupleB) { var distA = ManhattanDistance(tupleA, new Tuple <int, int>(X, Y)); var distB = ManhattanDistance(tupleB, new Tuple <int, int>(X, Y)); if (distA < distB) { return(1); } if (distA > distB) { return(-1); } return(0); }); foreach (var wPos in waterPos) { Desires.Enqueue(new Desire(TypesDesire.FindWater, new Desire(TypesDesire.GotoLocation, new Desire(TypesDesire.Dig, wPos)))); } } } }
/// <summary> /// We generate options based on the current list of desires /// </summary> protected virtual IEnumerable <Desire <TAction, TAgent, TEnvironment> > GenerateOptions() { //remove desires which have been fulfilled Desires.RemoveAll(x => x.IsFulfilled()); //only achievable desires return(Desires.Where(x => x.IsAchievable())); }
private void TakeItem(Desires itemReceived) { if (itemReceived == desire) { Debug.Log("I dont want " + itemReceived); } else { Debug.Log("Thank you!"); } playerInventory.RemoveItem(); SetDesire(); }
public Form1() { InitializeComponent(); sensors = new List <int>(); for (int i = 0; i < 26; i++) { sensors.Add(0); } sensors[0] = 1; List <Neuron> neurons = new List <Neuron>(); for (int i = 0; i < Desires.GetDictionary().Count; i++) { neurons.Add(new Neuron()); } perceptron = new Perceptron(neurons); }
/// <summary> /// Initializes the agent /// </summary> /// <param name="desires">The initial list of desires of the agent</param> /// <param name="intentions">The initial current intentions of the agent</param> /// <returns>A task in which the agent loop is run</returns> public virtual Task Init(List <Desire <TAction, TAgent, TEnvironment> > desires, List <Intention <TAction, TAgent, TEnvironment> > intentions) { if (desires != null) { Desires.AddRange(desires); foreach (var desire in desires) { desire.Agent = this; } } if (intentions != null) { CurrentIntentions.AddRange(intentions); } return(StartRun()); }
public Barricading(Desires.Barricading desire, Beliefs beliefs, BlockBeliefs blockBeliefs) : base(desire, beliefs) { _blockBeliefs = blockBeliefs; _destTiles = new List<Tile>(); var block = _blockBeliefs.Block; var dirs = new[] { Face.North, Face.East, Face.South, Face.West }; for (int x = 1; x < block.Width - 1; ++x) { for (int y = 1; y < block.Height - 1; ++y) { var tile = block[block.X + x, block.Y + y]; if (tile.IsInterior) continue; foreach (var dir in dirs) { if (tile.IsWallSolid(dir)) continue; var n = dir.GetNormal(); int xn = x + (int) n.X, yn = y + (int) n.Y; var neighbour = block[block.X + xn, block.Y + yn]; if (neighbour.IsInterior) { _destTiles.Add(tile); break; } } } } _pendingTiles = _destTiles.Where(x => x.StaticEntities.Count() == 0).ToArray(); }
public Migration(Desires.Migration desire, Beliefs beliefs) : base(desire, beliefs) { _destBlock = desire.Destination; var size = new Vector2(_destBlock.Width, _destBlock.Height); int tries = 16; do { _destPos = new Vector2(_destBlock.X, _destBlock.Y) + Vector2.Multiply(size, new Vector2( Tools.Random.NextSingle(0.4f, 0.6f), Tools.Random.NextSingle(0.4f, 0.6f))); _destPos.X = (float) Math.Round(_destPos.X - 0.5f) + 0.5f; _destPos.Y = (float) Math.Round(_destPos.Y - 0.5f) + 0.5f; } while (--tries > 0 && !Beliefs.Entity.World.IsPositionNavigable(_destPos)); if (tries <= 0) { _destPos = _destBlock.GetNearestPosition(Entity.Position2D); _destPos += (_destBlock.Center - _destPos).Normalized() * 2f; } _nav = new RouteNavigator(Entity, _destPos); }
/// <summary> /// Add a desire to the agent /// </summary> /// <param name="desire">The desire to add</param> public void AddDesire(Desire <TAction, TAgent, TEnvironment> desire) { Desires.Add(desire); desire.Agent = this; }
public PlayerMovementCommand(Desires.PlayerMovementCommand desire, Beliefs beliefs) : base(desire, beliefs) { _nav = new RouteNavigator(Entity, desire.Destination); }
public void AddItem(Desires item) { heldItem = item; }
public PlayerSpecifiedBarricading(Desires.PlayerSpecifiedBarricading desire, Beliefs beliefs) : base(desire, beliefs) { }
private void button26_Click(object sender, EventArgs e) { perceptron.Train(TrainData.GetDictionary(), Desires.GetDictionary()); MessageBox.Show("Done"); }
public void RemoveItem() { heldItem = Desires.noItem; }
public Wander(Desires.Wander desire, Beliefs beliefs) : base(desire, beliefs) { Randomize(); }
public void AddDesire([NotNull] PersonDesireDto desiredto) { Desires.Add(desiredto); }
public ThreatAvoidance(Desires.ThreatAvoidance desire, Beliefs beliefs) : base(desire, beliefs) { _threats = desire.Threats; }
public WallAvoidance(Desires.WallAvoidance desire, Beliefs beliefs) : base(desire, beliefs) { }
public PlanBarricade(Desires.PlanBarricade desire, Beliefs beliefs) : base(desire, beliefs) { }
/// <summary> /// Does our current intention needs reconsideration after we updated our beliefs /// </summary> /// <returns>True if we need to reconsider the current intention, false otherwise</returns> protected override bool NeedsReconsideration() { var currentStrength = CurrentIntentions.First().GetStrength(); return(Desires.Any(x => x.Strength >= currentStrength * 2)); }
public Mobbing(Desires.Mobbing desire, Beliefs beliefs) : base(desire, beliefs) { Target = desire.Target; }