/** * @brief Update the episodic memories for a given ape. * This is based upon a fading memory model in which older memories * are replaced by newer ones. Each memory has an associated affect * value indicating its emotional impact, and this fades over time. * * The rate of fading is genetically regulated, with different rates * for memories with positive and negative affect. * This facilitates optimistic/pessimistic and forgetful/memorable * type personalities. * * The fading memory model may not be strictly realistic, and might * be replaced by something else in future. * @param local_being pointer to the ape */ void episodic_cycle_no_sim(noble_being * local_being, void * data) { if (local_being->delta.awake == 0) return; { n_int i; noble_episodic * local_episodic = being_episodic(local_being); n_genetics * genetics = being_genetics(local_being); if (!local_episodic) return; for (i=0; i<EPISODIC_SIZE; i++) { if (local_episodic[i].event == 0) continue; /** remove intentions which are outdated */ if (local_episodic[i].event >= EVENT_INTENTION) { /** is this my intention, or someone else's? */ if (being_name_comparison(local_being, local_episodic[i].first_name[BEING_MEETER], local_episodic[i].family_name[BEING_MEETER])) { if (spacetime_before_now(&local_episodic[i].space_time)) { local_episodic[i].event = 0; continue; } } episodic_intention_update(local_being, i); } /** fade towards EPISODIC_AFFECT_ZERO */ if (local_episodic[i].affect < EPISODIC_AFFECT_ZERO) { /** negative memories fade */ if (EPISODIC_AFFECT_ZERO - local_episodic[i].affect > 16) { local_episodic[i].affect+=(1+GENE_NEGATIVE_AFFECT_FADE(genetics)); } else { local_episodic[i].affect++; } } else { if (local_episodic[i].affect > EPISODIC_AFFECT_ZERO) { /** positive memories fade */ if (local_episodic[i].affect - EPISODIC_AFFECT_ZERO > 16) { local_episodic[i].affect-=(1+GENE_POSITIVE_AFFECT_FADE(genetics)); } else { local_episodic[i].affect--; } } } } } }
/** * Update the episodic memories for a given ape. * This is based upon a fading memory model in which older memories * are replaced by newer ones. Each memory has an associated affect * value indicating its emotional impact, and this fades over time. * * The rate of fading is genetically regulated, with different rates * for memories with positive and negative affect. * This facilitates optimistic/pessimistic and forgetful/memorable * type personalities. * * The fading memory model may not be strictly realistic, and might * be replaced by something else in future. * @param local_sim pointer to the simulation * @param local pointer to the ape */ void episodic_cycle(noble_simulation * local_sim, noble_being * local) { n_int i; episodic_memory * local_episodic = GET_EPI(local_sim, local); if (!local_episodic) return; for (i=0; i<EPISODIC_SIZE; i++) { if (local_episodic[i].event == 0) continue; /** remove intentions which are outdated */ if (local_episodic[i].event >= EVENT_INTENTION) { /** is this my intention, or someone else's? */ if ((local_episodic[i].first_name[BEING_MEETER]==GET_NAME_GENDER(local_sim,local)) && (local_episodic[i].family_name[BEING_MEETER]==GET_NAME_FAMILY2(local_sim,local))) { if (local_episodic[i].date[0] < local_sim->land->date[0]) { local_episodic[i].event = 0; continue; } else { if (local_episodic[i].time < local_sim->land->time) { local_episodic[i].event = 0; continue; } } } episodic_intention_update(local_sim,local,i); } /** fade towards EPISODIC_AFFECT_ZERO */ if (local_episodic[i].affect < EPISODIC_AFFECT_ZERO) { /** negative memories fade */ if (EPISODIC_AFFECT_ZERO - local_episodic[i].affect > 16) { local_episodic[i].affect+=(1+GENE_NEGATIVE_AFFECT_FADE(GET_G(local))); } else { local_episodic[i].affect++; } } else { if (local_episodic[i].affect > EPISODIC_AFFECT_ZERO) { /** positive memories fade */ if (local_episodic[i].affect - EPISODIC_AFFECT_ZERO > 16) { local_episodic[i].affect-=(1+GENE_POSITIVE_AFFECT_FADE(GET_G(local))); } else { local_episodic[i].affect--; } } } } }