/// <summary> /// Calculates the difference in two dialects. Also, seattle and portland /// just seemed like they'd be better names than villageA and villageB. /// </summary> public float CalcDiff(VillageCtrl seattle, VillageCtrl portland) { float diffSq = 0f; foreach (Phoneme phone in phonemeOrder) { float s = seattle.AvgPronunciation(phone) * 100f; float p = portland.AvgPronunciation(phone) * 100f; s = Mathf.Round(s); p = Mathf.Round(p); float diff = s - p; diffSq += (diff * diff) / 100f; } return(Mathf.Sqrt(diffSq)); }
public void DisplayVillageLanguage(VillageCtrl villageCtrl) { AgentCtrl agent = villageCtrl.agents[0]; string s = ""; bool odd = true; foreach (Phoneme phone in agent.idiolect.Keys) { float f = villageCtrl.AvgPronunciation(phone); s += string.Format("{0} : {1:0.00}\t\t", phone.glyph, f); odd = !odd; if (odd) { s += "\n"; } } langTxt.text = s; }