Noble Ape
The Central Directories of the Noble Ape Simulation.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros | Functions
social.c File Reference

This handles social interactions and management of the social graph. More...

#include "entity.h"
#include "entity_internal.h"
Include dependency graph for social.c:

Go to the source code of this file.

Macros

#define GENE_STATUS_PREFERENCE(gene)   GENE_VAL_REG(gene, 15, 12, 10, 1)
#define GENE_PIGMENTATION_PREFERENCE(gene)   GENE_VAL_REG(gene, 5, 3, 11, 4)
#define GENE_HEIGHT_PREFERENCE(gene)   GENE_VAL_REG(gene, 9, 8, 14, 10)
#define GENE_FRAME_PREFERENCE(gene)   GENE_VAL_REG(gene, 9, 0, 8, 2)
#define GENE_HAIR_PREFERENCE(gene)   GENE_VAL_REG(gene, 10, 7, 14, 15)
#define GENE_GROOM(gene)   GENE_VAL_REG(gene, 14, 2, 5, 10)
#define GENE_AGGRESSION(gene)   GENE_VAL_REG(gene, 11, 3, 5, 0)
#define GENE_MATE_BOND(gene)   GENE_VAL_REG(gene, 10, 2, 4, 0)
#define GENE_INCEST_AVERSION(gene)   GENE_VAL_REG(gene, 10, 8, 4, 9)
#define GENE_LATENT_ENERGY_USE(gene)   GENE_VAL_REG(gene, 14, 3, 6, 10)

Functions

void social_graph_link_name (noble_simulation *local_sim, noble_being *local_being, n_int social_graph_index, n_byte met, n_string name)
 Returns a string for the name of the ape in the given social graph array index.
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 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_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_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_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_uint social_respect_mean (noble_simulation *sim, noble_being *local_being)
 Returns the average friend or foe value.
void social_conception (noble_being *female, noble_being *male, noble_simulation *sim)
 Update for a conception event. This stores the date, details of the father and resets drives and goals.
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.
void social_initial_loop (noble_simulation *local, noble_being *local_being, void *data)
void social_secondary_loop (noble_simulation *local, noble_being *local_being, void *data)

Detailed Description

This handles social interactions and management of the social graph.

Definition in file social.c.


Macro Definition Documentation

#define GENE_AGGRESSION (   gene)    GENE_VAL_REG(gene, 11, 3, 5, 0)

Aggression

Definition at line 69 of file social.c.

#define GENE_FRAME_PREFERENCE (   gene)    GENE_VAL_REG(gene, 9, 0, 8, 2)

mating preference for frame

Definition at line 57 of file social.c.

#define GENE_GROOM (   gene)    GENE_VAL_REG(gene, 14, 2, 5, 10)

Groom

Definition at line 65 of file social.c.

#define GENE_HAIR_PREFERENCE (   gene)    GENE_VAL_REG(gene, 10, 7, 14, 15)

mating preference for hair length

Definition at line 61 of file social.c.

#define GENE_HEIGHT_PREFERENCE (   gene)    GENE_VAL_REG(gene, 9, 8, 14, 10)

mating preference for height

Definition at line 53 of file social.c.

#define GENE_INCEST_AVERSION (   gene)    GENE_VAL_REG(gene, 10, 8, 4, 9)

Degree of aversion to incest

Definition at line 77 of file social.c.

#define GENE_LATENT_ENERGY_USE (   gene)    GENE_VAL_REG(gene, 14, 3, 6, 10)

Latent energy use

Definition at line 81 of file social.c.

#define GENE_MATE_BOND (   gene)    GENE_VAL_REG(gene, 10, 2, 4, 0)

Mate bond

Definition at line 73 of file social.c.

#define GENE_PIGMENTATION_PREFERENCE (   gene)    GENE_VAL_REG(gene, 5, 3, 11, 4)

Pigmentation preference

Definition at line 49 of file social.c.

#define GENE_STATUS_PREFERENCE (   gene)    GENE_VAL_REG(gene, 15, 12, 10, 1)

Status preference

Definition at line 45 of file social.c.


Function Documentation

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.

Parameters:
meeter_beingPointer to the ape doing the meeting
met_beingPointer to the ape being met
simPointer to the simulation
Returns:
Array index within the social graph of the meeter, -1 if not found

Definition at line 752 of file social.c.

Here is the call graph for this function:

n_int social_chat ( noble_being meeter_being,
noble_being met_being,
n_int  being_index,
noble_simulation sim 
)

Dialogue between beings.

Parameters:
meeter_beingPointer to the being doing the meeting
met_beingPointer to the being which is being met
being_indexArray index for the met individual within the social graph of the meeter
simPointer to the simulation
Returns:
A non-zero value if speaking

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.

Here is the call graph for this function:

void social_conception ( noble_being female,
noble_being male,
noble_simulation sim 
)

Update for a conception event. This stores the date, details of the father and resets drives and goals.

Parameters:
femalePointer to the mother
malePointer to the father
todayThe current date
simPointer to the simulation

store the date of conception

reset sex drive and goal

remember the event

Definition at line 1367 of file social.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
meeter_beingPointer to the ape
relationshipThe type of relationship to search for
simPointer to the simulation
Returns:
Array index of the social graph for the given type of relationship, -1 if not found

get the social graph

Search the social graph

Is this the desired relationship type?

Definition at line 977 of file social.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void social_goals ( noble_being local)

Goal oriented behavior.

Parameters:
localPointer to the ape
loc_fThe direction facing
Returns:
The new 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.

Here is the call graph for this function:

Here is the caller graph for this function:

void social_graph_link_name ( noble_simulation local_sim,
noble_being local_being,
n_int  social_graph_index,
n_byte  met,
n_string  name 
)

Returns a string for the name of the ape in the given social graph array index.

Parameters:
local_simPointer to the simulation
localbeingPinter to the ape
social_graph_indexArray index within the social graph
metBEING_MEETER=return name for the meeter, BEING_MET=return name for the met
nameReturned ape name

Get the social graph for the being

Definition at line 479 of file social.c.

Here is the call graph for this function:

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.

Parameters:
meeter_beingPointer to the ape doing the meeting
met_beingPointer to the ape being met
distanceDistance between the apes
awakeWhether the met being is awake
familiarityFamiliarity with the met ape
simPointer to the simulation
Returns:
1 if grooming, 0 otherwise

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.

Here is the call graph for this function:

void social_initial_loop ( noble_simulation local,
noble_being local_being,
void *  data 
)

< Bug fix for division by zero on the following line

Definition at line 1814 of file social.c.

Here is the call graph for this function:

Here is the caller graph for this function:

n_int social_mate ( noble_being meeter_being,
noble_being met_being,
n_int  being_index,
n_int  distance,
noble_simulation sim 
)

Mating behavior.

Parameters:
meeter_beingPointer to the ape doing the meeting
met_beingPointer to the ape whi is being met
todayThe current date
being_indexArray index for the met individual within the social graph of the meeter
distanceThe Distance between the two apes
simPointer to the simulation
Returns:
The being state: reproducing or not

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.

Here is the call graph for this function:

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.

Parameters:
meeter_beingPointer to the ape doing the meeting
met_beingPointer to the ape being met
distanceDistance between the apes
simPointer to the simulation
Returns:
Array index of the meeter social graph, -1 if not met

Definition at line 1051 of file social.c.

Here is the call graph for this function:

n_uint social_respect_mean ( noble_simulation sim,
noble_being local_being 
)

Returns the average friend or foe value.

Parameters:
simPointer to the simulation
local_beingPointer to the ape
Returns:
The average friend or foe value for all social graph entries

note that this includes the self

Definition at line 1332 of file social.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void social_secondary_loop ( noble_simulation local,
noble_being local_being,
void *  data 
)
Parameters:
localPointer to the simulation object
local_beingPointer to the being

Definition at line 1871 of file social.c.

Here is the caller graph for this function:

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.

Parameters:
meeter_beingPointer to the ape doing the meeting
relationshipThe type of relationship
met_beingPointer to the ape being met
simPointer to the simulation
Returns:
Array index of the meeter social graph, -1 if not met

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.

Here is the call graph for this function:

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.

Parameters:
meeter_beingPointer to the ape doing the meeting
met_beingPointer to the ape being met
distanceDistance between the apes
is_femaleWhether the met being is female
simPointer to the simulation
Returns:
The new being state: showforce/attack

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.

Here is the call graph for this function: