public void Can_create_a_drive_system_containing_same_manual_more_than_once() { var ds = new DriveSystem { Name = "Drive System 1" }; var englishManual = new Manual { Title = "Operation Manual", Language = "English" }; ds.Manuals.Add(englishManual); ds.Manuals.Add(englishManual); ds.Manuals.Add(new Manual { Title = "Operation Manual", Language = "German" }); Session.Save(ds); Session.Flush(); Session.Clear(); // Assertions var fromDb = Session.Get <DriveSystem>(ds.Id); Assert.AreEqual(ds.Manuals.Count, fromDb.Manuals.Count); // Assert that bag can really contain same equipment multiple times var temp = new List <Manual>(fromDb.Manuals); Assert.AreEqual(2, temp.FindAll(m => m.Title == englishManual.Title && m.Language == englishManual.Language).Count); }
public void Can_create_a_drive_system_containing_same_equipment_more_than_once() { var ds = new DriveSystem { Name = "Drive System 1" }; ds.Equipments.Add("Motor"); ds.Equipments.Add("Motor"); ds.Equipments.Add("Motor"); ds.Equipments.Add("Filter"); ds.Equipments.Add("Transformer"); ds.Equipments.Add("Starter"); Session.Save(ds); Session.Flush(); Session.Clear(); // Assertions var fromDb = Session.Get <DriveSystem>(ds.Id); Assert.AreNotSame(ds, fromDb); Assert.AreEqual(ds.Name, fromDb.Name); Assert.AreEqual(ds.Equipments.Count, fromDb.Equipments.Count); // Assert that bag can really contain same equipment multiple times var temp = new List <string>(fromDb.Equipments); Assert.AreEqual(3, temp.FindAll(e => e == "Motor").Count); }
public Animal(string objectType, string index, Genome motherGenome, Genome fatherGenome, Vector3 spawn) : base(objectType, index, motherGenome, fatherGenome, spawn, true) { InitBodyControl(spawn); driveSystem = new DriveSystem(this); sensorySystem = new SensorySystem(this); InitBrain(); }
public NeuralAI(Animal animal, Body body, DriveSystem drives, MotorSystem motor, SensorySystem senses, Phenotype phenotype) : base(body, drives, motor, senses, phenotype) { InitNetworkLayerInfoDict(); InitLayers(); InitConnections(); GetOutputConnectionDict(); InitInputs(); InitOutputs(); Feedforward(); }
private void Start() { Statistics.numRoboter++; actors = new Actors(motor); sensor = new Sensor(motor); driveSystem = new DriveSystem(actors, this); actors.aInfs = driveSystem; data = sensor.Sense(); random = new System.Random(motor.Pos.x * motor.Pos.y); if (manualGoal != null) { manualTarget = new Position(Mathf.RoundToInt(manualGoal.position.x), Mathf.RoundToInt(manualGoal.position.z)); } Thread t = new Thread(SensorEventSender); t.Start(); Arrived(); }
public void Can_create_a_drive_system_with_distinct_equipment() { var ds = new DriveSystem { Name = "Drive System 1" }; ds.Equipments.Add("Motor"); ds.Equipments.Add("Filter"); ds.Equipments.Add("Transformer"); ds.Equipments.Add("Starter"); Session.Save(ds); Session.Flush(); Session.Clear(); // Assertions var fromDb = Session.Get<DriveSystem>(ds.Id); Assert.AreNotSame(ds, fromDb); Assert.AreEqual(ds.Name, fromDb.Name); Assert.AreEqual(ds.Equipments.Count, fromDb.Equipments.Count); // Assert that sort is working Assert.AreEqual("Filter", fromDb.Equipments[0]); }
public void Can_create_a_drive_system_containing_same_manual_more_than_once() { var ds = new DriveSystem {Name = "Drive System 1"}; var englishManual = new Manual {Title = "Operation Manual", Language = "English"}; ds.Manuals.Add(englishManual); ds.Manuals.Add(englishManual); ds.Manuals.Add(new Manual {Title = "Operation Manual", Language = "German"}); Session.Save(ds); Session.Flush(); Session.Clear(); // Assertions var fromDb = Session.Get<DriveSystem>(ds.Id); Assert.AreEqual(ds.Manuals.Count, fromDb.Manuals.Count); // Assert that bag can really contain same equipment multiple times var temp = new List<Manual>(fromDb.Manuals); Assert.AreEqual(2, temp.FindAll(m => m.Title == englishManual.Title && m.Language == englishManual.Language).Count); }
public AI(Body body, DriveSystem drives, MotorSystem motor, SensorySystem senses, Phenotype phenotype) { bodyStates = body.GetStates(); bodyStateLabelList = body.GetStateLabels(); bodyStateIndexDict = body.GetStateIndices(); gameobject = body.GetGameObject(); driveStates = drives.GetStates(); driveStateLabelList = drives.GetStateLabels(); driveStateIndexDict = drives.GetStateIndices(); actionStates = motor.GetStates(); actionStateLabelList = motor.GetStateLabels(); actionStateIndexDict = motor.GetStateIndices(); traits = phenotype.GetTraits(); traitLabelList = phenotype.GetTraitLabels(); traitIndexDict = phenotype.GetTraitIndices(); visualInput = senses.GetVisualInput(); }
public void Can_create_a_drive_system_containing_same_equipment_more_than_once() { var ds = new DriveSystem { Name = "Drive System 1" }; ds.Equipments.Add("Motor"); ds.Equipments.Add("Motor"); ds.Equipments.Add("Motor"); ds.Equipments.Add("Filter"); ds.Equipments.Add("Transformer"); ds.Equipments.Add("Starter"); Session.Save(ds); Session.Flush(); Session.Clear(); // Assertions var fromDb = Session.Get<DriveSystem>(ds.Id); Assert.AreNotSame(ds, fromDb); Assert.AreEqual(ds.Name, fromDb.Name); Assert.AreEqual(ds.Equipments.Count, fromDb.Equipments.Count); // Assert that bag can really contain same equipment multiple times var temp = new List<string>(fromDb.Equipments); Assert.AreEqual(3, temp.FindAll(e => e == "Motor").Count); }
public void Can_create_a_drive_system_with_distinct_equipment() { var ds = new DriveSystem { Name = "Drive System 1" }; ds.Equipments.Add("Motor"); ds.Equipments.Add("Filter"); ds.Equipments.Add("Transformer"); ds.Equipments.Add("Starter"); Session.Save(ds); Session.Flush(); Session.Clear(); // Assertions var fromDb = Session.Get <DriveSystem>(ds.Id); Assert.AreNotSame(ds, fromDb); Assert.AreEqual(ds.Name, fromDb.Name); Assert.AreEqual(ds.Equipments.Count, fromDb.Equipments.Count); // Assert that sort is working Assert.AreEqual("Filter", fromDb.Equipments[0]); }
public SimpleAI(Animal animal, Body body, DriveSystem drives, MotorSystem motor, SensorySystem senses, Phenotype traits) : base(body, drives, motor, senses, traits) { thisAnimal = animal; //InitGoalDict(); }