public Character(string name) { Beliefs = new BeliefSet(); Name = name; CharacterSentiment = new Dictionary <string, Feelings>(); CharacterConversations = new Dictionary <string, List <Statement> >(); }
/// <summary> /// A recursive function that will update the beliefs for one block /// </summary> /// <param name="oldBeliefsetBlocks">The old beliefbase</param> /// <param name="newBeliefsetBlocks">The new beliefbase</param> /// <param name="block">The block being perceived</param> private void UpdateFactForOneBlock(BeliefSet oldBeliefsetBlocks, BeliefSet newBeliefsetBlocks, Block block) { newBeliefsetBlocks.AddFact(block); if (block.Upper != null) { UpdateFactForOneBlock(oldBeliefsetBlocks, newBeliefsetBlocks, block.Upper); } }
private static void BuildEventBeliefs(BeliefSet res) { var suspects = new List <string> { "Miss Scarlet", "Professor Plum", "Mrs. Peacock", "Mr. Green", "Mrs. White" }; var actions = new List <string> { "stab", "shoot", "strangle", "maul", "poison" }; var victims = new List <string> { "the cat", "Mr. Mulberry", "Roger Rabbit", "Mr. Boddy" }; var info = new EventInformation() { Subject = "Colonel Mustard", Verb = "throw a piano on", Object = "the cat", IsTrue = true, Reason = "Because he sure hated that cat", Time = "11 AM yesterday", Place = "In the living room" }; res.AddEvent(info); foreach (var action in actions) { var falseInfo = new EventInformation() { Subject = "Colonel Mustard", Verb = action, Object = "the cat", IsTrue = false }; res.AddEvent(falseInfo); } foreach (var suspect in suspects) { var falseInfo = new EventInformation() { Subject = suspect, Verb = "throw a piano on", Object = "the cat", IsTrue = false }; res.AddEvent(falseInfo); } }
public static BeliefSet BuildBeliefSet() { var res = new BeliefSet(); BuildAttributeBeliefs(res); BuildEventBeliefs(res); return(res); }
/// <summary> /// The beliefbase of the agent is updated through the received percepts /// </summary> /// <param name="percepts">The percepts as a list of keyvalue pairs</param> protected override void UpdateBeliefs(Dictionary <string, object> percepts) { var perceptedTable = (Table)percepts["table"]; BeliefBase.UpdateBelief(new Belief("table", perceptedTable)); BeliefBase.UpdateBelief(new Belief("inarm", InArm)); var beliefsetBlocks = BeliefBase.GetBeliefSet("blocks"); var newBeliefSetBlocks = new BeliefSet("blocks"); foreach (var block in perceptedTable.Blocks) { UpdateFactForOneBlock(beliefsetBlocks, newBeliefSetBlocks, block); } BeliefBase.UpdateBeliefSet(newBeliefSetBlocks); }
private static void BuildAttributeBeliefs(BeliefSet res) { var suspects = new List <string> { "Miss Scarlet", "Professor Plum", "Mrs. Peacock", "Mr. Green", "Mrs. White" }; var adjectives1 = new List <string> { "tall" }; var adjectives2 = new List <string> { "evil", "bemustached" }; foreach (var suspect in suspects) { foreach (var adjective in adjectives1) { var info = new AttributeInformation() { Subject = suspect, Adjective = adjective, IsTrue = true }; res.AddSubjectAttribute(info); } foreach (var adjective in adjectives2) { var info = new AttributeInformation() { Subject = suspect, Adjective = adjective, IsTrue = false }; res.AddSubjectAttribute(info); } } foreach (var adjective in adjectives2) { var info = new AttributeInformation() { Subject = "Colonel Mustard", Adjective = adjective, IsTrue = true }; res.AddSubjectAttribute(info); } foreach (var adjective in adjectives1) { var info = new AttributeInformation() { Subject = "Colonel Mustard", Adjective = adjective, IsTrue = false }; res.AddSubjectAttribute(info); } }