Noble Ape
The Central Directories of the Noble Ape Simulation.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros | Typedefs | Functions | Variables
brain.c File Reference
#include "entity.h"
#include "entity_internal.h"
#include <stdio.h>
Include dependency graph for brain.c:

Go to the source code of this file.

Macros

#define BRAINCODE_MIN_MVB_SPACING   2
#define BRAINCODE_CONSTANT0_BIT   (64)
#define BRAINCODE_CONSTANT1_BIT   (128)
#define BRAINCODE_DATA_START   BRAINCODE_DAT0
#define BRAINCODE_DATA_NUMBER   (1 + BRAINCODE_DAT1 - BRAINCODE_DATA_START)
#define BRAINCODE_OPERATORS_START   BRAINCODE_ADD
#define BRAINCODE_OPERATORS_NUMBER   (1 + BRAINCODE_LTP - BRAINCODE_OPERATORS_START)
#define BRAINCODE_CONDITIONALS_START   BRAINCODE_JMZ
#define BRAINCODE_CONDITIONALS_NUMBER   (1 + BRAINCODE_SLT - BRAINCODE_CONDITIONALS_START)
#define BRAINCODE_SENSORS_START   BRAINCODE_SEN
#define BRAINCODE_SENSORS_NUMBER   (1 + BRAINCODE_SEN3 - BRAINCODE_SENSORS_START)
#define BRAINCODE_ACTUATORS_START   BRAINCODE_ACT
#define BRAINCODE_ACTUATORS_NUMBER   (1 + BRAINCODE_ANE - BRAINCODE_ACTUATORS_START)
#define BRAINCODE_INSTRUCTION(braincode, i)   ((braincode[i] & (BRAINCODE_CONSTANT0_BIT-1)) % BRAINCODE_INSTRUCTIONS)
#define BRAINCODE_CONSTANT0(braincode, i)   (braincode[i] & BRAINCODE_CONSTANT0_BIT)
#define BRAINCODE_CONSTANT1(braincode, i)   (braincode[i] & BRAINCODE_CONSTANT1_BIT)
#define BRAINCODE_VALUE(braincode, i, n)   (braincode[i+1+n])
#define B_SIZE   (32768)
#define B_WR   (B_SIZE - 1)
#define F_X   (1)
#define F_Y   (32)
#define F_Z   (1024)
#define B_Z   (B_SIZE - F_Z)
#define B_Y   (B_SIZE - F_Y)
#define B_X   (B_SIZE - F_X)
#define B_FN(ave, bra, obra)   ((ave+bra-obra)>>10)
#define B_P_LH   (br[loc+F_Z]+br[loc+F_Y]+br[loc+F_X])
#define B_P_UH   (br[loc-F_X]+br[loc-F_Y]+br[loc-F_Z])
#define B_N_LH   (br[(loc+F_X)&B_WR]+br[(loc+F_Y)&B_WR]+br[(loc+F_Z)&B_WR])
#define B_N_UH   (br[(loc+B_Z)&B_WR]+br[(loc+B_Y)&B_WR]+br[(loc+B_X)&B_WR])
#define BC_FORMAT_A   0
#define BC_FORMAT_C   1
#define BC_FORMAT_E   2
#define BC_FORMAT_F   3
#define BC_FORMAT_G   4
#define BC_FORMAT_H   5
#define IS_CONST0   (is_constant0 ? value0 : addr0[0])
#define IS_CONST1   (is_constant1 ? value1 : addr1[0])

Typedefs

typedef n_intn_similar )(noble_episodic *episodic, n_int *carry_through)

Functions

void brain_cycle (n_byte *local, n_byte2 *constants)
 Updates the brain.
void brain_three_byte_command (n_string string, n_byte *response)
 prints a three byte instruction in the appropriate format
void brain_sentence (n_string string, n_byte *response)
 A simple sort of sentence construction from three byte instructions.
n_byte get_braincode_instruction_type (n_byte instruction_type)
 returns a random braincode instruction of the given type
void braincode_number_of_instructions (noble_simulation *sim, noble_being *local_being, n_int *no_of_sensors, n_int *no_of_actuators, n_int *no_of_operators, n_int *no_of_conditionals, n_int *no_of_data)
n_byte get_braincode_instruction (noble_being *local_being)
 returns a random braincode instruction
void brain_dialogue (noble_simulation *sim, n_byte awake, noble_being *meeter_being, noble_being *met_being, n_byte *bc0, n_byte *bc1, n_int being_index)
 Two beings meet and chat, or a being engages in an internal dialogue.

Variables

const n_string braincode_mnemonic [BRAINCODE_INSTRUCTIONS]
const n_string braincode_spoken_dictionary [BRAINCODE_INSTRUCTIONS]

Macro Definition Documentation

#define B_FN (   ave,
  bra,
  obra 
)    ((ave+bra-obra)>>10)

Definition at line 90 of file brain.c.

#define B_N_LH   (br[(loc+F_X)&B_WR]+br[(loc+F_Y)&B_WR]+br[(loc+F_Z)&B_WR])

Definition at line 95 of file brain.c.

#define B_N_UH   (br[(loc+B_Z)&B_WR]+br[(loc+B_Y)&B_WR]+br[(loc+B_X)&B_WR])

Definition at line 96 of file brain.c.

#define B_P_LH   (br[loc+F_Z]+br[loc+F_Y]+br[loc+F_X])

positive and negative, lower and upper halves

Definition at line 93 of file brain.c.

#define B_P_UH   (br[loc-F_X]+br[loc-F_Y]+br[loc-F_Z])

Definition at line 94 of file brain.c.

#define B_SIZE   (32768)

Definition at line 69 of file brain.c.

#define B_WR   (B_SIZE - 1)

Definition at line 70 of file brain.c.

#define B_X   (B_SIZE - F_X)

Definition at line 76 of file brain.c.

#define B_Y   (B_SIZE - F_Y)

Definition at line 75 of file brain.c.

#define B_Z   (B_SIZE - F_Z)

Definition at line 74 of file brain.c.

#define BC_FORMAT_A   0

"XXX_#NNN_#NNN" "0123456789012"

Definition at line 186 of file brain.c.

#define BC_FORMAT_C   1

Definition at line 187 of file brain.c.

#define BC_FORMAT_E   2

Definition at line 188 of file brain.c.

#define BC_FORMAT_F   3

Definition at line 189 of file brain.c.

#define BC_FORMAT_G   4

Definition at line 190 of file brain.c.

#define BC_FORMAT_H   5

Definition at line 191 of file brain.c.

#define BRAINCODE_ACTUATORS_NUMBER   (1 + BRAINCODE_ANE - BRAINCODE_ACTUATORS_START)

Definition at line 60 of file brain.c.

#define BRAINCODE_ACTUATORS_START   BRAINCODE_ACT

Definition at line 59 of file brain.c.

#define BRAINCODE_CONDITIONALS_NUMBER   (1 + BRAINCODE_SLT - BRAINCODE_CONDITIONALS_START)

Definition at line 54 of file brain.c.

#define BRAINCODE_CONDITIONALS_START   BRAINCODE_JMZ

Definition at line 53 of file brain.c.

#define BRAINCODE_CONSTANT0 (   braincode,
 
)    (braincode[i] & BRAINCODE_CONSTANT0_BIT)

Definition at line 63 of file brain.c.

#define BRAINCODE_CONSTANT0_BIT   (64)

Definition at line 44 of file brain.c.

#define BRAINCODE_CONSTANT1 (   braincode,
 
)    (braincode[i] & BRAINCODE_CONSTANT1_BIT)

Definition at line 64 of file brain.c.

#define BRAINCODE_CONSTANT1_BIT   (128)

Definition at line 45 of file brain.c.

#define BRAINCODE_DATA_NUMBER   (1 + BRAINCODE_DAT1 - BRAINCODE_DATA_START)

Definition at line 48 of file brain.c.

#define BRAINCODE_DATA_START   BRAINCODE_DAT0

Definition at line 47 of file brain.c.

#define BRAINCODE_INSTRUCTION (   braincode,
 
)    ((braincode[i] & (BRAINCODE_CONSTANT0_BIT-1)) % BRAINCODE_INSTRUCTIONS)

Definition at line 62 of file brain.c.

#define BRAINCODE_MIN_MVB_SPACING   2

Definition at line 42 of file brain.c.

#define BRAINCODE_OPERATORS_NUMBER   (1 + BRAINCODE_LTP - BRAINCODE_OPERATORS_START)

Definition at line 51 of file brain.c.

#define BRAINCODE_OPERATORS_START   BRAINCODE_ADD

Definition at line 50 of file brain.c.

#define BRAINCODE_SENSORS_NUMBER   (1 + BRAINCODE_SEN3 - BRAINCODE_SENSORS_START)

Definition at line 57 of file brain.c.

#define BRAINCODE_SENSORS_START   BRAINCODE_SEN

Definition at line 56 of file brain.c.

#define BRAINCODE_VALUE (   braincode,
  i,
 
)    (braincode[i+1+n])

Definition at line 65 of file brain.c.

#define F_X   (1)

Definition at line 71 of file brain.c.

#define F_Y   (32)

Definition at line 72 of file brain.c.

#define F_Z   (1024)

Definition at line 73 of file brain.c.

#define IS_CONST0   (is_constant0 ? value0 : addr0[0])

Definition at line 1138 of file brain.c.

#define IS_CONST1   (is_constant1 ? value1 : addr1[0])

Definition at line 1139 of file brain.c.


Typedef Documentation

typedef n_int( n_similar)(noble_episodic *episodic, n_int *carry_through)

Definition at line 656 of file brain.c.


Function Documentation

void brain_cycle ( n_byte local,
n_byte2 constants 
)

Updates the brain.

Parameters:
localPointer to the brain array
constantsArray containing brain constants

Definition at line 103 of file brain.c.

Here is the call graph for this function:

void brain_dialogue ( noble_simulation sim,
n_byte  awake,
noble_being meeter_being,
noble_being met_being,
n_byte bc0,
n_byte bc1,
n_int  being_index 
)

Two beings meet and chat, or a being engages in an internal dialogue.

Parameters:
simPointer to the simulation object
awakeWhether the being is awake
meeter_beingPointer to the being doing the meeting
met_beingPointer to the being which was met
bc0Braincode of the meeter
bc1Braincode of the met
being_indexSocial graph index of the being which is the current focus of attention

fixed number of itterations for internal dialogue

variable number of itterations for chat

clear episodes visited. This array helps to avoid repeatedly visiting the same memories

General sensor

Shift attention to a different actor

store the current focus of attention

Shift attention to a different episode

Shift attention to a different territory

Shift attention to a body region

Shift attention to a similar location

Shift attention to a similar time

Shift attention to a similar date

Shift attention to a similar name

Shift attention to a similar affect

atmosphere pressure

wind magnitude

attention to body

territory name

territory familiarity

territory familiarity

carrying object

shift attention to a given social graph entry based on relationship

store the current focus of attention

shift attention to a different relationship type

store the current relationship attention

If attention has shifted to a new episode

Shift attention to the being in this episode

store the change in attention

set territory attention to the location where the episode occurred

Action

individual or social action

Set location goal

alter friend or foe value

alter attraction

alter familiarity

The values 10 and 20 meetings were just found experimentally

brainprobe frequency

brainprobe address

shout out

volume of message

type of message

intention

brainprobe offset

posture

brainprobe position

alter learned preferences

spread anecdote

not internal dialogue

avoid repeated anecdotes in the same conversation

Definition at line 1152 of file brain.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void brain_sentence ( n_string  string,
n_byte response 
)

A simple sort of sentence construction from three byte instructions.

Parameters:
stringThe returned sentence
responseArray containing three byte instruction

Definition at line 442 of file brain.c.

Here is the call graph for this function:

void brain_three_byte_command ( n_string  string,
n_byte response 
)

prints a three byte instruction in the appropriate format

Parameters:
stringThe returned string
responseArray containing the three byte instruction

Definition at line 406 of file brain.c.

Here is the caller graph for this function:

void braincode_number_of_instructions ( noble_simulation sim,
noble_being local_being,
n_int no_of_sensors,
n_int no_of_actuators,
n_int no_of_operators,
n_int no_of_conditionals,
n_int no_of_data 
)

Definition at line 510 of file brain.c.

Here is the call graph for this function:

n_byte get_braincode_instruction ( noble_being local_being)

returns a random braincode instruction

Parameters:
local_beingPointer to the being
Returns:
braincode instruction

Definition at line 570 of file brain.c.

Here is the call graph for this function:

Here is the caller graph for this function:

n_byte get_braincode_instruction_type ( n_byte  instruction_type)

returns a random braincode instruction of the given type

Parameters:
instruction_typeNumber indicating the type of instruction
Returns:
braincode instruction

< GENE_BRAINCODE_SENSORS(genetics);

< GENE_BRAINCODE_ACTUATORS(genetics);

< GENE_BRAINCODE_CONDITIONALS(genetics);

< GENE_BRAINCODE_OPERATORS(genetics);

< GENE_BRAINCODE_DATA(genetics);

Definition at line 486 of file brain.c.

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const n_string braincode_mnemonic[BRAINCODE_INSTRUCTIONS]
Initial value:
{
"DAT0",
"DAT1",
"ADD ",
"SUB ",
"MUL ",
"DIV ",
"MOD ",
"MVB ",
"MOV ",
"JMP ",
"CTR ",
"SWP ",
"INV ",
"STP ",
"LTP ",
"JMZ ",
"JMN ",
"DJN ",
"AND ",
"OR ",
"SEQ ",
"SNE ",
"SLT ",
"SEN ",
"SEN2",
"SEN3",
"ACT ",
"ACT2",
"ACT3",
"ANE "
}

Definition at line 193 of file brain.c.

const n_string braincode_spoken_dictionary[BRAINCODE_INSTRUCTIONS]
Initial value:
{
"a",
"o",
"mam",
"vos",
"sie",
"fes",
"feo",
"mas",
"vam",
"amo",
"sam",
"mao",
"ova",
"eef",
"fee",
"om",
"ov",
"fi",
"im",
"se",
"es",
"os",
"is",
"favos",
"vamos",
"famov",
"iema",
"iova",
"iafi",
"ovma",
}

"aeio" "fmsv";

Definition at line 313 of file brain.c.