//in case the speakers need to be swapped public void swapSpeakers() { PhysicalEntity_Agent temp = initiatingSpeaker; initiatingSpeaker = respondingSpeaker; respondingSpeaker = temp; }
public int add(PhysicalEntity_Agent k)//TODO definitely need a better ID function. e.g. once that actually gives unique id codes and one that always gives the same object the same ID { worldArray.Add(k); agentArray.Add(k); k.ID = k.GetHashCode() /*k.nodeName + r.NextDouble().ToString()*/; return(k.ID);//now the game has a copy of the ID used to identify this object }
public FarewellMode farewellMode;//none, 2stroke, 4stroke //public enum PolitenessMode { friendly, normal, polite } //constructor chooses default settings public ConversationalParamaters(ConversationType cType, PhysicalEntity_Agent participantOne, PhysicalEntity_Agent participantTwo, World world) { r = new Random(); userSpecifiedTopicsList = new Queue <Topic>(); //participantsArray = new ArrayList(2);//default only two participants this.participantOne = participantOne; this.participantTwo = participantTwo; this.world = world; greetingMode = GreetingMode.twoTurn; //smallTalkMode = 0; farewellMode = FarewellMode.simple; autoGeneratePairParamaterss = false;//off by default //TODO use this somehow discourseType = DiscourseType.@default; //TODO choose register in a more inteligent way registerType = RegisterType.casual_register; //contains one case for every type of conversation switch (cType) { case ConversationType.helloOnly: setDefaultsForHelloOnly(); break; case ConversationType.businessShortExchange: setDefaultsForBusinessShortExchange(); break; default: break; } //autoFillUnspecifiedParamaters(); }
private void newWorld() { worldManager = new WorldEngine(); worldManager.newWorld("Hello World"); //insert objects PhysicalEntity pe0; pe0 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("area")); pe0.properNoun = "Europe"; pe0.oneOfAKind = true; int europe = worldManager.world.add(pe0);//int is the ID of the object PhysicalEntity pe; pe = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("country")); pe.properNoun = "Germany"; pe.oneOfAKind = true; pe.setSpatialParent(Preposition.@in, pe0); int germany = worldManager.world.add(pe);//int is the ID of the object PhysicalEntity pe2 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("state")); pe2.properNoun = "LowerSaxony"; pe2.setSpatialParent(Preposition.@in, pe); pe2.oneOfAKind = true; int lowerSaxony = worldManager.world.add(pe2);//int is the ID of the object PhysicalEntity pe3 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("state")); pe3.properNoun = "Osnabrück"; pe3.setSpatialParent(Preposition.@in, pe2); pe3.oneOfAKind = true; int osna = worldManager.world.add(pe3);//int is the ID of the object PhysicalEntity nrw = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("state")); nrw.properNoun = "North Rhine Westfalia"; nrw.setSpatialParent(Preposition.@in, pe2); nrw.oneOfAKind = true; int nrwInt = worldManager.world.add(nrw);//int is the ID of the object PhysicalEntity pe4 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("area")); pe4.properNoun = "Westerberg Campus"; pe4.setSpatialParent(Preposition.@in, pe3); pe4.oneOfAKind = true; int westerberg = worldManager.world.add(pe4);//int is the ID of the object PhysicalEntity pe5 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("area")); pe5.properNoun = "Schloss Campus"; pe5.setSpatialParent(Preposition.@in, pe3);//in osnabrueck pe5.oneOfAKind = true; int schloss = worldManager.world.add(pe5);//int is the ID of the object PhysicalEntity pe6 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("area")); pe6.properNoun = "Mensa"; pe6.setSpatialParent(Preposition.@on, pe4); pe6.oneOfAKind = false; int mensa = worldManager.world.add(pe6);//int is the ID of the object PhysicalEntity pe7 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("banana")); //pe4.properNoun = "Westerberg Campus"; pe7.setSpatialParent(Preposition.@in, pe6); pe7.oneOfAKind = true; int banana = worldManager.world.add(pe7);//int is the ID of the object PhysicalEntity pe8 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("coffee")); //pe4.properNoun = "Westerberg Campus"; pe8.setSpatialParent(Preposition.@in, pe6); pe8.oneOfAKind = true; int coffee = worldManager.world.add(pe8);//int is the ID of the object PhysicalEntity pe9 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("mango")); //pe4.properNoun = "Westerberg Campus"; pe9.setSpatialParent(Preposition.@in, pe6); pe9.oneOfAKind = true; int mango = worldManager.world.add(pe9);//int is the ID of the object PhysicalEntity pe10 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("banana")); //pe4.properNoun = "Westerberg Campus"; pe10.setSpatialParent(Preposition.@in, pe6); pe10.oneOfAKind = true; int banana2 = worldManager.world.add(pe10);//int is the ID of the object PhysicalEntity pe11 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("bar")); pe11.properNoun = "Sauber von Oz"; pe11.setSpatialParent(Preposition.@in, worldManager.world.findByProperNoun("Osnabrück")); pe11.oneOfAKind = true; int svo = worldManager.world.add(pe10);//int is the ID of the object PhysicalEntity pe12 = new PhysicalEntity(worldManager.typeDictionary.tryGetValue("beer")); //pe11.properNoun = "Sauber von Oz"; pe11.setSpatialParent(Preposition.@in, pe11); pe11.oneOfAKind = true; int thingy = worldManager.world.add(pe12);//int is the ID of the object PhysicalEntity_Agent pe13 = new PhysicalEntity_Agent(worldManager.typeDictionary.tryGetValue("human"), "John", "Snow", PhysicalEntity_Agent.Gender.male); //pe11.properNoun = "Sauber von Oz"; pe11.setSpatialParent(Preposition.on, pe4); pe11.oneOfAKind = true; int agent1 = worldManager.world.add(pe13);//int is the ID of the object PhysicalEntity_Agent pe14 = new PhysicalEntity_Agent(worldManager.typeDictionary.tryGetValue("human"), "Mary", "Jane", PhysicalEntity_Agent.Gender.female); //pe11.properNoun = "Sauber von Oz"; pe11.setSpatialParent(Preposition.on, pe4); pe11.oneOfAKind = true; int agent2 = worldManager.world.add(pe14);//int is the ID of the object /*END adding objects*/ worldManager.saveWorldFile(); loadWorld(); }
private String renderOpinionReason(Opinion opinion, PhysicalEntity_Agent speaker, PhysicalEntity_Agent interlocutor) { return("because " + renderDescriptor(opinion.reason)); }
} //default politeness 6 public PairParamaters(PhysicalEntity_Agent initiatingSpeaker, PhysicalEntity_Agent respondingSpeaker, int politeness) { this.initiatingSpeaker = initiatingSpeaker; this.respondingSpeaker = respondingSpeaker; }
//constructor chain with default politeness value public PairParamaters(PhysicalEntity_Agent initiatingSpeaker, PhysicalEntity_Agent respondingSpeaker) : this(initiatingSpeaker, respondingSpeaker, 6) { } //default politeness 6
/*helper function renders verb object * paramaters: a verb object to render. A physicalEntity which is the speaker * knowing who the speaker is is important, we check the speaker against the subject and objects of the verb * for conjugation and pronouns * * this function does three things * 1. first render the base verb * 2. then check if there is an object, if there is, render that too * 3. then check if there is a second object, if there is render it as well * each object can be either an entity or a type of entity. */ private String renderVerb(Verb v, PhysicalEntity_Agent utterer, PhysicalEntity_Agent interlocutor) { String output = ""; /*first - base verb*/ output += v.adverb + " ";//TODO in some sentences the adverb should come after the verb. He quickly sits down. He sits down quickly if (v.subject != utterer) { output += v._verbThirdPersonSingular + " "; } else//subject is same as speaker { output += v._verbInfinitive + " "; } output += v.intransitive_preposition + " "; if (v.object_one != null) { /*check for any pronoun possibilities * first check for you/me/he/she * then check for reflexives * then check for ownership * * TODO any kind of plural */ //first check if its you or me, but not reflexive if (v.object_one == utterer && v.subject != utterer) { output += "me "; } else if (v.object_one == interlocutor && v.subject != interlocutor) { output += "you "; } //second check for reflexives else if (v.object_one == v.subject) { /* * if the subject is the same as the object it needs to be reflexive * there are 3 possibilities for singular * 1 the subject and object are me * 2 the subject and object are you * 3 the subject and object are sombody else * * TODO plurals */ //possibility 1 if (v.subject == utterer) { output += "myself "; } //possibility 2 else if (v.subject == interlocutor) { //check if it has gender or not output += "yourself "; } //possiblity 3 else//we already know theyre the same object so no need to check again { //if its a typedefinition, THEMSELVES if (v.object_one.GetType() == typeof(TypeDefinition)) { output += "themselves "; } //else its a PhysicalEntity, get it to tell its own reflexive pronoun else if (v.object_one.GetType() == typeof(PhysicalEntity)) { output += ((PhysicalEntity)v.object_one).reflexivePronoun + " "; } else { //TODO plurals OURSELVES THEMSELVES } } }//end doing pronouns, just render it as a constituent as normal else { output += v.object_one_preposition + renderConstituent(v.object_one, false) + " ";//TODO only supports singular objects } output += v.object_one_adverb + " "; //repeat process for object 2 //TODO copy above code and just tweak it to apply to object two instead //if (v.object_two != null) } return(output); }
public Turn(PhysicalEntity_Agent p, string s) { participant = p; utterance = s; }
//TODO get randomOTHERparticipant(participantOne) returns a random participant other than the one passed in PhysicalEntity_Agent randomRespondingSpeaker(PhysicalEntity_Agent initiatingSpeaker) { //TODO actual algorithm that return random participant return(conversationalParamaters.participantTwo); }
/*SEARCH FUNCTIONS*/ //get all by type //search by preposition + child //search by preposition + parent //search by adjectives //overloadded to not always need an exact person //public Opinion getOpinion(String personsName, object thingToOpine) //{ // //WARNING findAgentByName returns null if not found. would result in breaking // return getOpinion(findAgentByName(personsName), thingToOpine); //} public Opinion getOpinion(PhysicalEntity_Agent person, object thingToOpine) { Opinion result; //first see if this agent already has an opinion on this topic (or on a related topic, e.g. a sibling, parent or child) //if yes, simply return it result = person.tryGetOpinion(thingToOpine); if (result != null) { return(result); } /*else, make one*/ else { //make a new opinion object if (thingToOpine.GetType() == typeof(PhysicalEntity)) { result = new Opinion(person, (PhysicalEntity)thingToOpine); } else if ((thingToOpine.GetType() == typeof(TypeDefinition))) { result = new Opinion(person, (TypeDefinition)thingToOpine); } else { //TODO break //now we have a blank opinion object, we need to populate the fields /*TODO * algorithm for deciding whether we like or dislike something * check if we already like the parent * check if we already like one of the traits of this object in another object. * * check probability of liking it or disliking it, also do the same for the parent * check if it has a common trait/reason with any existing opinions. e.g. i dont like snakes because they're slimy, fish are also slimy * if you make a contradictory opinion, add it as an exception to the existing opinion * * * reason: a trait, liking/disliking the parent/liking/disliking a sibling with the same trait * comparator: it's the cudliest animal, its the best cake in town, it's my favorite horse * (some kind of fitness function that perfers some reasons and comparisons over others, e.g. not enough evidence) */ result.likes = true; } //now create a reason for the opinion Descriptor myReason = new Descriptor(); myReason.verb = "is"; myReason.trait = "tasty"; myReason.value = true; //add the reason to the opinion, and add the opinion to the person result.reason = myReason; person.addOpinion(result); return(result); } }
public Opinion(PhysicalEntity_Agent opiner, TypeDefinition subject) { this.opiner = opiner; subjectTypeDefinition = subject; }
public Opinion(PhysicalEntity_Agent opiner, PhysicalEntity subject) { this.opiner = opiner; subjectEntity = subject; }