|
Noble Ape
The Central Directories of the Noble Ape Simulation.
|
Go to the source code of this file.
Data Structures | |
| struct | being_nearest |
Macros | |
| #define | CONSUME_E(being, max_energy, food) |
| #define | OFFSET_GRASS 40 |
| #define | OFFSET_BUSH 14 |
Enumerations | |
| enum | sleep_state { FULLY_ASLEEP = 0, SLIGHTLY_AWAKE = 1, FULLY_AWAKE = 2 } |
Functions | |
| void | body_genetics (noble_being *beings, n_int number, n_genetics *genetics, n_genetics *mother_genetics, n_genetics *father_genetics, n_byte2 *local) |
| n_int | food_eat (n_land *local_land, n_int loc_x, n_int loc_y, n_int az, n_byte *food_type, noble_being *local_being) |
| Eat food at the given location and return the energy increase. | |
| n_int | food_absorption (noble_being *local, n_int max_energy, n_byte food_type) |
| How much energy is absorbed from a given type of food. | |
| void | food_values (n_land *local_land, n_int loc_x, n_int loc_y, n_int *grass, n_int *trees, n_int *bush) |
| Returns the values for grass, trees and bushes at the given location. | |
| n_int | genetics_compare (n_genetics *genetics_a, n_genetics *genetics_b) |
| Compares two genetics and returns 1 if they are the same. | |
| void | genetics_set (n_genetics *genetics_a, n_genetics *n_genetics) |
| Sets genetics A to be the same as genetics B. | |
| void | genetics_zero (n_genetics *genetics_a) |
| Creates a blank genome. | |
| void | metabolism_init (noble_being *local_being) |
| void | metabolism_cycle (noble_simulation *local_sim, noble_being *local_being) |
| void | metabolism_vascular_response (noble_simulation *local_sim, noble_being *local_being, n_int response) |
| void | metabolism_eat (noble_being *local_being, n_byte food_type) |
| void | metabolism_suckle (noble_simulation *sim, noble_being *child, noble_being *mother) |
| void | social_action (noble_simulation *sim, noble_being *meeter_being, noble_being *met_being, n_byte action) |
| Performs a given action. | |
| n_int | social_network (noble_being *meeter_being, noble_being *met_being, n_int distance, noble_simulation *sim) |
| When two apes meet within a given maximum range this updates the social graph of both. | |
| n_int | social_set_relationship (noble_being *meeter_being, n_byte relationship, noble_being *met_being, noble_simulation *sim) |
| Set the relationship type between two apes. | |
| n_int | social_get_relationship (noble_being *meeter_being, n_byte relationship, noble_simulation *sim) |
| Returns the social graph index of the given relationship type. This can be used for example to search for the father of an ape within the social graph. | |
| n_byte | social_groom (noble_being *meeter_being, noble_being *met_being, n_int distance, n_int awake, n_byte2 familiarity, noble_simulation *sim) |
| Grooming behavior. | |
| n_byte2 | social_squabble (noble_being *meeter_being, noble_being *met_being, n_uint distance, n_int is_female, noble_simulation *sim) |
| Squabbling and fighting. | |
| n_int | social_mate (noble_being *meeter_being, noble_being *met_being, n_int being_index, n_int distance, noble_simulation *sim) |
| Mating behavior. | |
| n_int | social_chat (noble_being *meeter_being, noble_being *met_being, n_int being_index, noble_simulation *sim) |
| Dialogue between beings. | |
| void | social_goals (noble_being *local) |
| Goal oriented behavior. | |
| n_int | get_noble_social (noble_being *meeter_being, noble_being *met_being, noble_simulation *sim) |
| If two beings have previously met return the social graph index. | |
| n_int | episodic_met_being_celebrity (noble_simulation *local_sim, noble_being *meeter_being, noble_being *met_being) |
| Returns a celebrity factor based upon how many apes within the episodic memory of the given ape have a similar name to the met ape, and their friend or foe values. This means that initial beliefs about other apes are partly a form of stereotyping. | |
| void | episodic_store_memory (noble_being *local, n_byte event, n_int affect, noble_simulation *local_sim, n_byte2 name1, n_byte2 family1, n_byte2 name2, n_byte2 family2, n_byte2 arg) |
| Updates the episodic memory with details about an event. | |
| void | episodic_food (noble_simulation *local_sim, noble_being *local, n_int energy, n_byte food_type) |
| Remember eating. | |
| void | episodic_self (noble_simulation *local_sim, noble_being *local, n_byte event, n_int affect, n_byte2 arg) |
| Store an episodic memory about the self. | |
| void | episodic_close (noble_simulation *local_sim, noble_being *local, noble_being *other, n_byte event, n_int affect, n_byte2 arg) |
| Remember an event which occurred between being in close proximity. | |
| void | episodic_interaction (noble_simulation *local_sim, noble_being *local, noble_being *other, n_byte event, n_int affect, n_byte2 arg) |
| Remember a particular interaction between two beings. | |
| n_byte | episodic_intention (noble_simulation *local_sim, noble_being *local, n_int episode_index, n_byte2 mins_ahead, n_byte args) |
| Generate an intention. Note that intentions are stored together with episodic memories, with the event type making the difference between a memory about the past and an intention about the future. | |
| n_byte | episodic_anecdote (noble_simulation *local_sim, noble_being *local, noble_being *other) |
| Copy an episodic memory (an anecdote) from one ape to another during chat. | |
| void | being_init_braincode (noble_being *local, noble_being *other, n_byte friend_foe, n_byte internal) |
| n_byte | get_braincode_instruction (noble_being *local_being) |
| returns a random braincode instruction | |
| void | being_ingest_pathogen (noble_being *local, n_byte food_type) |
| #define CONSUME_E | ( | being, | |
| max_energy, | |||
| food | |||
| ) |
Definition at line 46 of file entity_internal.h.
| #define OFFSET_BUSH 14 |
Definition at line 50 of file entity_internal.h.
| #define OFFSET_GRASS 40 |
Definition at line 49 of file entity_internal.h.
| enum sleep_state |
Definition at line 39 of file entity_internal.h.
| void being_ingest_pathogen | ( | noble_being * | local, |
| n_byte | food_type | ||
| ) |
| void being_init_braincode | ( | noble_being * | local, |
| noble_being * | other, | ||
| n_byte | friend_foe, | ||
| n_byte | internal | ||
| ) |
initialise inner or outer braincode
initially seed the brain with instructions which are random but genetically biased
initialise based upon a similar being
Find the entry in the social graph with the most similar friend or foe value. The FOF value is used because when two beings meet for the first time this value is calculated based upon a variety of genetic and learned dispositions. Notice also that the search includes index zero, which is the self.
Copy braincode for the most similar individual
Definition at line 3084 of file being.c.
| void body_genetics | ( | noble_being * | beings, |
| n_int | number, | ||
| n_genetics * | genetics, | ||
| n_genetics * | mother_genetics, | ||
| n_genetics * | father_genetics, | ||
| n_byte2 * | local | ||
| ) |
| n_byte episodic_anecdote | ( | noble_simulation * | local_sim, |
| noble_being * | local, | ||
| noble_being * | other | ||
| ) |
Copy an episodic memory (an anecdote) from one ape to another during chat.
| local_sim | Pointer to the simulation |
| local | Pointer to the ape conveying the anecdote |
| other | Pointer to the ape to which the anecdote will be copied |
both protagonists must be awake
more likely to make errors while drowsy
mutate with some probability
affect gets exaggerated or downplayed
keep affect within range
find an index within the other episodic memory in which to insert
other ape pays attention to the incoming anecdote
Definition at line 684 of file episodic.c.
| void episodic_close | ( | noble_simulation * | local_sim, |
| noble_being * | local, | ||
| noble_being * | other, | ||
| n_byte | event, | ||
| n_int | affect, | ||
| n_byte2 | arg | ||
| ) |
Remember an event which occurred between being in close proximity.
| local_sim | Pointer to the simulation object |
| local | Pointer to the first being |
| other | Pointer to the second being |
| event | The type of event |
| affect | Affect value associated with the event |
| arg | Any additional argument |
Definition at line 556 of file episodic.c.
| void episodic_food | ( | noble_simulation * | local_sim, |
| noble_being * | local, | ||
| n_int | energy, | ||
| n_byte | food_type | ||
| ) |
Remember eating.
| local_sim | Pointer to the simulation object |
| local | Pointer to the being |
| energy | Energy obtained from food |
| food_type | The type of food |
Definition at line 498 of file episodic.c.
| n_byte episodic_intention | ( | noble_simulation * | local_sim, |
| noble_being * | local, | ||
| n_int | episode_index, | ||
| n_byte2 | mins_ahead, | ||
| n_byte | args | ||
| ) |
Generate an intention. Note that intentions are stored together with episodic memories, with the event type making the difference between a memory about the past and an intention about the future.
| local_sim | Pointer to the simulation |
| local | Pointer to the ape |
| episode_index | Episodic memory array index to use. |
| mins_ahead | The number of minutes into the future for which the intention will last. |
| args | Any additional arguments |
increment date by one day
extend the time of an existing intention
if this was someone else's intention it now becomes yours
only certain types of events become intentions
find a memory index to replace
Definition at line 604 of file episodic.c.
| void episodic_interaction | ( | noble_simulation * | local_sim, |
| noble_being * | local, | ||
| noble_being * | other, | ||
| n_byte | event, | ||
| n_int | affect, | ||
| n_byte2 | arg | ||
| ) |
Remember a particular interaction between two beings.
| local_sim | Pointer to the simulation object |
| local | Pointer to the being |
| other | Pointer to the being being interacted with |
| event | The type of event |
| affect | The affect associated with the interaction |
| arg | Any additional argument |
Definition at line 578 of file episodic.c.
| n_int episodic_met_being_celebrity | ( | noble_simulation * | local_sim, |
| noble_being * | meeter_being, | ||
| noble_being * | met_being | ||
| ) |
Returns a celebrity factor based upon how many apes within the episodic memory of the given ape have a similar name to the met ape, and their friend or foe values. This means that initial beliefs about other apes are partly a form of stereotyping.
| local_sim | pointer to the simulation |
| meeter_being | pointer to the ape |
| met_being | pointer to another ape |
check all episodic memories of the meeter
check both the meeter and the met ape for each memory
same first name
same family name
if both first name and family name match then increase the celebrity value further
limit within range
Definition at line 207 of file episodic.c.
| void episodic_self | ( | noble_simulation * | local_sim, |
| noble_being * | local, | ||
| n_byte | event, | ||
| n_int | affect, | ||
| n_byte2 | arg | ||
| ) |
Store an episodic memory about the self.
| local_sim | Pointer to the simulation object |
| local | Pointer to the being |
| event | The type of event |
| affect | An affect value associated with the event |
| arg | Any additional argument |
Definition at line 536 of file episodic.c.
| void episodic_store_memory | ( | noble_being * | local, |
| n_byte | event, | ||
| n_int | affect, | ||
| noble_simulation * | local_sim, | ||
| n_byte2 | name1, | ||
| n_byte2 | family1, | ||
| n_byte2 | name2, | ||
| n_byte2 | family2, | ||
| n_byte2 | arg | ||
| ) |
Updates the episodic memory with details about an event.
| local | Pointer to the ape |
| event | The type of event |
| affect | The affect value associated with the event |
| local_sim | Pointer to the simulation |
| name1 | Name of the first ape in the memory (meeter) |
| family1 | Family name of the first ape in the memory (meeter) |
| name2 | Name of the second ape in the memory (met) |
| family2 | Family name of the second ape in the memory (met) |
| arg | Any additional arguments |
Definition at line 517 of file episodic.c.
| n_int food_absorption | ( | noble_being * | local, |
| n_int | max_energy, | ||
| n_byte | food_type | ||
| ) |
How much energy is absorbed from a given type of food.
| food_type | The type of food |
| local | pointer to the ape |
note that the absorbition for different foods is normalised
ingest pathogens from certain foods
< can only eat so much in one go
Definition at line 75 of file food.c.
| n_int food_eat | ( | n_land * | local_land, |
| n_int | loc_x, | ||
| n_int | loc_y, | ||
| n_int | az, | ||
| n_byte * | food_type, | ||
| noble_being * | local_being | ||
| ) |
Eat food at the given location and return the energy increase.
| sim | Pointer to the simulation |
| loc_x | X ape coordinate |
| loc_y | Y ape coordinate |
| az | Z ape coordinate |
| local_being | Pointer to the ape |
above the high water mark
in the intertidal zone
Definition at line 278 of file food.c.
| void food_values | ( | n_land * | local_land, |
| n_int | loc_x, | ||
| n_int | loc_y, | ||
| n_int * | grass, | ||
| n_int * | trees, | ||
| n_int * | bush | ||
| ) |
Returns the values for grass, trees and bushes at the given location.
| local_land | Pointer to the land |
| local_weather | Pointer to the weather |
| loc_x | X ape coordinate on the map |
| loc_y | Y ape coordinate on the lap |
| grass | Returned value for grass |
| trees | Returned value for trees |
| bush | Returned value for bushes |
grass at this location
trees at this location
bushes at this location
| n_int genetics_compare | ( | n_genetics * | genetics_a, |
| n_genetics * | genetics_b | ||
| ) |
| void genetics_set | ( | n_genetics * | genetics_a, |
| n_genetics * | genetics_b | ||
| ) |
| void genetics_zero | ( | n_genetics * | genetics_a | ) |
| n_byte get_braincode_instruction | ( | noble_being * | local_being | ) |
| n_int get_noble_social | ( | noble_being * | meeter_being, |
| noble_being * | met_being, | ||
| noble_simulation * | sim | ||
| ) |
If two beings have previously met return the social graph index.
| meeter_being | Pointer to the ape doing the meeting |
| met_being | Pointer to the ape being met |
| sim | Pointer to the simulation |
Definition at line 752 of file social.c.
| void metabolism_cycle | ( | noble_simulation * | local_sim, |
| noble_being * | local_being | ||
| ) |
| void metabolism_eat | ( | noble_being * | local_being, |
| n_byte | food_type | ||
| ) |
| void metabolism_init | ( | noble_being * | local_being | ) |
| void metabolism_suckle | ( | noble_simulation * | sim, |
| noble_being * | child, | ||
| noble_being * | mother | ||
| ) |
| void metabolism_vascular_response | ( | noble_simulation * | local_sim, |
| noble_being * | local_being, | ||
| n_int | response | ||
| ) |
| void social_action | ( | noble_simulation * | sim, |
| noble_being * | local, | ||
| noble_being * | other, | ||
| n_byte | action | ||
| ) |
Performs a given action.
| sim | Pointer to the simulation object |
| local | Pointer to the being performing the action |
| other | Pointer to another being involved in the action |
| action | The type of action |
individual action
social action
Definition at line 519 of file body.c.
| n_int social_chat | ( | noble_being * | meeter_being, |
| noble_being * | met_being, | ||
| n_int | being_index, | ||
| noble_simulation * | sim | ||
| ) |
Dialogue between beings.
| meeter_being | Pointer to the being doing the meeting |
| met_being | Pointer to the being which is being met |
| being_index | Array index for the met individual within the social graph of the meeter |
| sim | Pointer to the simulation |
agree upon terrirory
do I respect their views ?
pick one of the individuals from their graph
ask about an individual we're searching for
what type of family relationship is currently being attended to
choose randomly
have I already met this individual?
was already met
update this being's belief
belief about location
belief about state
if we have never met then add to my graph as someone I've "heard of". This is like a prior expectation or second hand information. The least familiar relationship is replaced
if this is a family member of the previously unknown being then make sure that the family member type is set to OTHER - i.e. not my family someone else's
initialise the braincode
Definition at line 1601 of file social.c.
| n_int social_get_relationship | ( | noble_being * | meeter_being, |
| n_byte | relationship, | ||
| noble_simulation * | sim | ||
| ) |
Returns the social graph index of the given relationship type. This can be used for example to search for the father of an ape within the social graph.
| meeter_being | Pointer to the ape |
| relationship | The type of relationship to search for |
| sim | Pointer to the simulation |
get the social graph
Search the social graph
Is this the desired relationship type?
Definition at line 977 of file social.c.
| void social_goals | ( | noble_being * | local | ) |
Goal oriented behavior.
| local | Pointer to the ape |
| loc_f | The direction facing |
move towards a location
are we there yet?
destination reached - goal cancelled
clear any script override
decrement the goal counter
timed out
Definition at line 1765 of file social.c.
| n_byte social_groom | ( | noble_being * | meeter_being, |
| noble_being * | met_being, | ||
| n_int | distance, | ||
| n_int | awake, | ||
| n_byte2 | familiarity, | ||
| noble_simulation * | sim | ||
| ) |
Grooming behavior.
| meeter_being | Pointer to the ape doing the meeting |
| met_being | Pointer to the ape being met |
| distance | Distance between the apes |
| awake | Whether the met being is awake |
| familiarity | Familiarity with the met ape |
| sim | Pointer to the simulation |
hairy beings can carry more parasites
acquire parasites from the environment with some low probability, and existing parasites multiply
parasites sap energy
hairy beings can carry more parasites
parasite transmission - e.g. flea hop
social grooming removes parasites and alters social status relationships
is the groomee female?
grooming preference
individuals which are familiar tend to groom more often
transmit pathogens via touch
pick a body location to groom
groomed wounds disappear
grooming location becomes the new focus of attention
the two beings meet and become more friendly
Alter social status relations. The groomer gains status, since they are providing a service
Decrement parasites
Definition at line 1075 of file social.c.
| n_int social_mate | ( | noble_being * | meeter_being, |
| noble_being * | met_being, | ||
| n_int | being_index, | ||
| n_int | distance, | ||
| noble_simulation * | sim | ||
| ) |
Mating behavior.
| meeter_being | Pointer to the ape doing the meeting |
| met_being | Pointer to the ape whi is being met |
| today | The current date |
| being_index | Array index for the met individual within the social graph of the meeter |
| distance | The Distance between the two apes |
| sim | Pointer to the simulation |
mating is probabilistic, with a bias towards higher status individuals
attractiveness based upon various criteria
some minimum level of attraction required for pair bonding
transmit pathogens
check opposite sexes
< '=' : conversion from 'n_int' to 'n_byte', possible loss of data
Definition at line 1425 of file social.c.
| n_int social_network | ( | noble_being * | meeter_being, |
| noble_being * | met_being, | ||
| n_int | distance, | ||
| noble_simulation * | sim | ||
| ) |
When two apes meet within a given maximum range this updates the social graph of both.
| meeter_being | Pointer to the ape doing the meeting |
| met_being | Pointer to the ape being met |
| distance | Distance between the apes |
| sim | Pointer to the simulation |
Definition at line 1051 of file social.c.
| n_int social_set_relationship | ( | noble_being * | meeter_being, |
| n_byte | relationship, | ||
| noble_being * | met_being, | ||
| noble_simulation * | sim | ||
| ) |
Set the relationship type between two apes.
| meeter_being | Pointer to the ape doing the meeting |
| relationship | The type of relationship |
| met_being | Pointer to the ape being met |
| sim | Pointer to the simulation |
no relationship specified
create the social graph entry if necessary and return its array index
get the social graph
set the relationship type
Definition at line 1013 of file social.c.
| n_byte2 social_squabble | ( | noble_being * | meeter_being, |
| noble_being * | met_being, | ||
| n_uint | distance, | ||
| n_int | is_female, | ||
| noble_simulation * | sim | ||
| ) |
Squabbling and fighting.
| meeter_being | Pointer to the ape doing the meeting |
| met_being | Pointer to the ape being met |
| distance | Distance between the apes |
| is_female | Whether the met being is female |
| sim | Pointer to the simulation |
distance between beings
battle with rival families
high ranking apes will more aggressively defend their honor
females are less agressive (less testosterone)
who is the strongest ?
victor disrespects the vanquished
vanquished disrespects the victor
victor increases in honor
vanquished decreases in honor
show of force
attack
remember the fight
vanquished turns away
vanquished flees
Definition at line 1212 of file social.c.
1.8.1.1