public void ProcessTruth(CommsEvent comm) { if (comm == null || !CurrentTurnAlreadyProcessedComms.Contains(comm)) { CurrentTurnAlreadyProcessedComms.Add(comm); } else { return; } KnownTruths.Add(comm); Relation(comm.Speaker.Id).SuspicionThisTurn -= .3; }
public void PreprocessAllComms() { // calculates LastNightWentOutProbability and detects contradictions foreach (var comm in CurrentTurnComms.Where(x => x.Speaker != Me)) { var thisRelation = Relation(comm.Speaker.Id); var aboutSamePerson = CurrentTurnComms.Where(x => x.Whom == comm.Whom && x != comm); if (aboutSamePerson.Any()) { foreach (var a in aboutSamePerson) { var otherTrust = MIstrustToMult(Relation(a.Speaker.Id).DarkSideSuspicion); if (KnownTruths.Contains(a)) { otherTrust = 100; } if (KnownLies.Contains(a)) { otherTrust -= 100; } if (AreMutuallyExclusive(a.EventType, comm.EventType) ) { thisRelation.ContradictionsThisTurn += otherTrust; thisRelation.SuspicionThisTurn += otherTrust * .5; } else if (AreEquivalent(a.EventType, comm.EventType)) { if (a.Where == comm.Where || a.Where == null || comm.Where == null) // could be null - that's fine { thisRelation.ContradictionsThisTurn -= otherTrust * .5; thisRelation.SuspicionThisTurn -= otherTrust * .2; } else if (a.Where != comm.Where) { thisRelation.ContradictionsThisTurn += otherTrust; thisRelation.SuspicionThisTurn += otherTrust * .5; } } // else the two assertions are orthoganal } } } foreach (var comm in CurrentTurnComms.Where(x => x.Speaker != Me)) { var thisRelation = Relation(comm.Speaker.Id); var trust = TrustThisTurn(comm.Speaker.Id); switch (comm.EventType) { case CommsTypeEnum.Slept: case CommsTypeEnum.WillSleep: if (comm.Whom.Id != Me.Id) { LastNightWentOutProbability[comm.Whom.Id] -= trust * .5; } break; case CommsTypeEnum.WentOut: if (comm.Whom.Id != Me.Id) { LastNightWentOutProbability[comm.Whom.Id] += trust * .5; } break; } } }