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

Go to the source code of this file.

Macros

#define CONSOLE_IDEA_MIN_BLOCK_SIZE   3
#define CONSOLE_IDEA_MAX_BLOCK_SIZE   8

Functions

n_int console_executing (void)
void console_external_watch (void)
n_int console_being (void *ptr, n_string response, n_console_output output_function)
n_int get_time_interval (n_string str, n_int *number, n_int *interval)
n_int console_simulation (void *ptr, n_string response, n_console_output output_function)
n_int console_list (void *ptr, n_string response, n_console_output output_function)
n_int console_next (void *ptr, n_string response, n_console_output output_function)
n_int console_previous (void *ptr, n_string response, n_console_output output_function)
void console_populate_braincode (noble_simulation *local_sim, line_braincode function)
n_int console_genome (void *ptr, n_string response, n_console_output output_function)
n_int console_stats (void *ptr, n_string response, n_console_output output_function)
n_int console_probes (void *ptr, n_string response, n_console_output output_function)
n_int console_episodic (void *ptr, n_string response, n_console_output output_function)
n_int console_social_graph (void *ptr, n_string response, n_console_output output_function)
n_int console_braincode (void *ptr, n_string response, n_console_output output_function)
n_int console_speech (void *ptr, n_string response, n_console_output output_function)
n_int console_appearance (void *ptr, n_string response, n_console_output output_function)
n_int console_event (void *ptr, n_string response, n_console_output output_function)
n_int console_logging (void *ptr, n_string response, n_console_output output_function)
n_int console_idea (void *ptr, n_string response, n_console_output output_function)
n_int console_watch (void *ptr, n_string response, n_console_output output_function)
n_int console_interval (void *ptr, n_string response, n_console_output output_function)
n_int console_stop (void *ptr, n_string response, n_console_output output_function)
n_int console_file (void *ptr, n_string response, n_console_output output_function)
n_int console_step (void *ptr, n_string response, n_console_output output_function)
n_int console_run (void *ptr, n_string response, n_console_output output_function)
n_int console_reset (void *ptr, n_string response, n_console_output output_function)
n_int console_speak (void *ptr, n_string response, n_console_output output_function)
n_int console_alphabet (void *ptr, n_string response, n_console_output output_function)
n_int console_save (void *ptr, n_string response, n_console_output output_function)
n_int console_open (void *ptr, n_string response, n_console_output output_function)
n_int console_script (void *ptr, n_string response, n_console_output output_function)
n_int console_top (void *ptr, n_string response, n_console_output output_function)
n_int console_debug (void *ptr, n_string response, n_console_output output_function)
n_int console_epic (void *ptr, n_string response, n_console_output output_function)
n_int console_quit (void *ptr, n_string response, n_console_output output_function)

Variables

const n_string RUN_STEP_CONST = "RSC"
n_int watch_type = WATCH_NONE
n_int watch_string_length = 0
n_int nolog = 0
n_int indicator_index = 1
n_uint save_interval_steps = 60
n_int console_file_interaction = 0
n_string_block console_file_name

Macro Definition Documentation

#define CONSOLE_IDEA_MAX_BLOCK_SIZE   8
#define CONSOLE_IDEA_MIN_BLOCK_SIZE   3

Function Documentation

n_int console_alphabet ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Definition at line 1732 of file console.c.

Here is the call graph for this function:

n_int console_appearance ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Show appearance values

Parameters:
ptrpointer to noble_simulation object
response
output_function
Returns:
0

Definition at line 905 of file console.c.

n_int console_being ( void *  ptr,
n_string  response,
n_console_output  output_function 
)
Parameters:
ptrpointer to noble_simulation object
responsecommand parameters
output_function

Definition at line 92 of file console.c.

Here is the call graph for this function:

n_int console_braincode ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Show the braincode

Parameters:
ptrpointer to noble_simulation object
response
output_function
Returns:
0

Definition at line 887 of file console.c.

n_int console_debug ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Definition at line 1992 of file console.c.

Here is the call graph for this function:

n_int console_epic ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Lists the most talked about beings, based upon episodic memories

Parameters:
ptrpointer to noble_simulation object
responsecommand parameters
output_functionfunction used to display the output
Returns:
0

clear the list of beings and their hit scores

get the being

get the episodic memories for the being

skip is no memories were retrieved

for all memories

non-empty slot

j = 0 is the being having the memory j = 1 is the being who is the subject of the memory

name should be non-zero

Avoid memories about yourself, since we're interested in gossip about other beings

add this being to the list, or increment its hit score

< last entry in the list

being found in the list

increment the hit score for the being

top 10 most epic beings

search the rest of the list

< end of the list

if this being has more hits then swap list entries, so that the most popular beings are at the top of the list

swap

get the name of the being

free list memory

Definition at line 2006 of file console.c.

Here is the call graph for this function:

n_int console_episodic ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Show the episodic memory

Parameters:
ptrpointer to noble_simulation object
response
output_function
Returns:
0

Definition at line 863 of file console.c.

n_int console_event ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Definition at line 1107 of file console.c.

Here is the call graph for this function:

n_int console_executing ( void  )

Definition at line 69 of file console.c.

void console_external_watch ( void  )

Definition at line 74 of file console.c.

Here is the call graph for this function:

Here is the caller graph for this function:

n_int console_file ( void *  ptr,
n_string  response,
n_console_output  output_function 
)
Parameters:
ptr
response
output_function

Definition at line 1501 of file console.c.

Here is the call graph for this function:

n_int console_genome ( void *  ptr,
n_string  response,
n_console_output  output_function 
)
Parameters:
ptrpointer to noble_simulation object
response
output_function
Returns:
0

Definition at line 827 of file console.c.

n_int console_idea ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Shows repeated sections of braincode

Parameters:
ptr
response
output_function
Returns:
0

Definition at line 1215 of file console.c.

Here is the call graph for this function:

n_int console_interval ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Set the time interval for simulation

Parameters:
ptrpointer to noble_simulation object
responsecommand parameters
output_functionfunction used to display the output
Returns:
0

Definition at line 1439 of file console.c.

Here is the call graph for this function:

n_int console_list ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Shows the names of all beings

Parameters:
ptr
responseparameters of the command
output_functionfunction used to display the result
Returns:
0

show names in index order

get the being

get the name of the being

Definition at line 350 of file console.c.

Here is the call graph for this function:

n_int console_logging ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Enable or disable logging

Parameters:
ptrpointer to noble_simulation object
responsecommand parameters - off/on/0/1/yes/no
output_functionfunction to be used to display output
Returns:
0

Definition at line 1143 of file console.c.

n_int console_next ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Definition at line 395 of file console.c.

Here is the call graph for this function:

n_int console_open ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Definition at line 1856 of file console.c.

Here is the caller graph for this function:

void console_populate_braincode ( noble_simulation local_sim,
line_braincode  function 
)

Definition at line 408 of file console.c.

Here is the call graph for this function:

Here is the caller graph for this function:

n_int console_previous ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Definition at line 401 of file console.c.

Here is the call graph for this function:

n_int console_probes ( void *  ptr,
n_string  response,
n_console_output  output_function 
)
Parameters:
ptrpointer to noble_simulation object
response
output_function
Returns:
0

Definition at line 851 of file console.c.

n_int console_quit ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Definition at line 2174 of file console.c.

Here is the call graph for this function:

Here is the caller graph for this function:

n_int console_reset ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Reset the simulation

Parameters:
ptrpointer to noble_simulation object
responsecommand parameters
output_functionfunction used to display the output
Returns:
0

Definition at line 1670 of file console.c.

Here is the call graph for this function:

n_int console_run ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Run the simulation

Parameters:
ptrpointer to noble_simulation object
responsecommand parameters
output_functionfunction used to display the output
Returns:
0

Definition at line 1566 of file console.c.

Here is the call graph for this function:

n_int console_save ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Definition at line 1739 of file console.c.

Here is the call graph for this function:

Here is the caller graph for this function:

n_int console_script ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Definition at line 1862 of file console.c.

Here is the caller graph for this function:

n_int console_simulation ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Show details of the overall simulation

Parameters:
ptrpointer to a noble_simulation object
responseparameters of the command
output_functionfunction to be used to display the result
Returns:
0

Definition at line 299 of file console.c.

Here is the call graph for this function:

n_int console_social_graph ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Show the social graph

Parameters:
ptrpointer to noble_simulation object
response
output_function
Returns:
0

Definition at line 875 of file console.c.

n_int console_speak ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Definition at line 1721 of file console.c.

Here is the call graph for this function:

n_int console_speech ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Definition at line 892 of file console.c.

n_int console_stats ( void *  ptr,
n_string  response,
n_console_output  output_function 
)
Parameters:
ptrpointer to noble_simulation object
response
output_function
Returns:
0

Definition at line 839 of file console.c.

n_int console_step ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Run the simulation for a single time interval

Parameters:
ptrpointer to noble_simulation object
responsecommand parameters
output_functionfunction used to display the output
Returns:
0

Definition at line 1514 of file console.c.

Here is the call graph for this function:

Here is the caller graph for this function:

n_int console_stop ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Definition at line 1485 of file console.c.

Here is the caller graph for this function:

n_int console_top ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Displays beings in descending order of honor value

Parameters:
ptrpointer to noble_simulation object
responsecommand parameters
output_functionfunction used to display the output
Returns:
0

Definition at line 1874 of file console.c.

Here is the call graph for this function:

n_int console_watch ( void *  ptr,
n_string  response,
n_console_output  output_function 
)

Watch a particular being

Parameters:
ptrpointer to noble_simulation object
responsecommand parameters
output_functionfunction to be used to display output
Returns:
0

Definition at line 1316 of file console.c.

Here is the call graph for this function:

n_int get_time_interval ( n_string  str,
n_int number,
n_int interval 
)

gets the number of mins/hours/days/months/years

Parameters:
strtext to be processed
number
interval
Returns:
number of mins/hours/days/months/years

Definition at line 214 of file console.c.

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

n_int console_file_interaction = 0

Definition at line 66 of file console.c.

n_string_block console_file_name

Definition at line 67 of file console.c.

n_int indicator_index = 1

number of steps to periodically log simulation indicators

Definition at line 61 of file console.c.

n_int nolog = 0

enable or disable logging to file

Definition at line 58 of file console.c.

const n_string RUN_STEP_CONST = "RSC"

Definition at line 49 of file console.c.

n_uint save_interval_steps = 60

How many steps at which to periodically save the simulation

Definition at line 64 of file console.c.

n_int watch_string_length = 0

keeps a running count of the total string length

Definition at line 55 of file console.c.

n_int watch_type = WATCH_NONE

The type of watch

Definition at line 52 of file console.c.