51 #define VISIBILITY_MAXIMUM (2000)
53 #define VISIBILITY_SPAN (VISIBILITY_MAXIMUM / ((15+16) >> 1))
55 #define WALK_ON_WATER(pz,w) (((pz)<w) ? w : (pz))
59 #define GENE_SWIM(gene) GENE_VAL_REG(gene, 9, 11, 13, 7)
63 #define GENE_SPEED(gene) GENE_VAL_REG(gene, 14, 5, 12, 10)
67 #define GENE_STAGGER(gene) GENE_VAL_REG(gene, 12, 14, 3, 11)
71 #define GENE_HILL_CLIMB(gene) GENE_VAL_REG(gene, 4, 6, 5, 2)
135 value->
seed[0] = seed[0];
136 value->
seed[1] = seed[1];
141 value->
seed[1] = seed1;
154 if (memory_available < 1)
159 number_apes = (memory_available /
sizeof(
noble_being)) - 1;
163 return SHOW_ERROR(
"Not enough memory for an ape");
167 local->
max = LARGE_SIM;
174 while (lpx < local->max)
189 n_int three_offset = (asleep ? 0 : 3);
198 n_int three_offset = (asleep ? 0 : 3);
204 return ((states[0] != 0) || (states[1] != 1024) || (states[2] != 0));
230 vanquished->
honor = temp_hon;
252 if (local_honor < 250)
254 return (
n_byte)(1 + (local_honor>>6));
271 return (value->
posture < post);
409 return value->
drives[drive];
422 if (value->
drives[drive] > 0)
445 n_int it_water_turn = 0;
450 while (it_water_turn < 7)
453 n_int iturn = 8 - it_water_turn;
455 n_int iturn_plus = loc_f + iturn;
456 n_int iturn_minus = loc_f + (256-iturn);
466 vect2_add(&temp_vector, &temp_vector, &location_vector);
471 vect2_add(&temp_vector, &temp_vector, &location_vector);
475 if (z_minus > z_plus)
479 else if (z_minus < z_plus)
489 return ((value)->inventory[location]>>3)<<3;
494 (value)->inventory[location] &= 7;
500 (value)->inventory[location] |=
object;
507 while (loop < sim->num)
510 if (output != being_not)
512 bf_func(sim, output, data);
541 n_int count = beings_per_thread;
542 while (loop < sim->num)
546 if ((beings_per_thread + loop) >= sim->
num)
548 count = sim->
num - loop;
553 if (count != beings_per_thread)
563 being_loop_generic(sim, 0L, bf_func, 0L);
584 n_int span10 = ((abs_sum - 1) ? 1448 : 1024);
586 switch (seven_values)
611 local_z += being_pixel->
start_z;
623 n_vect2 start, delta, vector_facing;
641 if ((delta.
x == 0) && (delta.
y == 0))
648 if (
vect2_dot(&vector_facing, &delta, 1, 64) < 0)
660 if ((delta.
x == 0) && (delta.
y == 0))
671 if(common_divisor == 0)
679 vect2_d(&offset, &delta, 512 * delta_z, common_divisor);
681 start_z -=
vect2_dot(&start, &offset, 1, 512);
692 translate.
land = land;
800 if (being_los_projection(land, local,lx,ly) == 1)
803 if ((local_facing == 6) || (local_facing == 7) || (local_facing == 0) || (local_facing == 1) || (local_facing == 2))
809 if ((local_facing == 7) || (local_facing == 0) || (local_facing == 1) || (local_facing == 2) || (local_facing == 3))
814 if ((local_facing == 0) || (local_facing == 1) || (local_facing == 2) || (local_facing == 3) || (local_facing == 4))
819 if ((local_facing == 1) || (local_facing == 2) || (local_facing == 3) || (local_facing == 4) || (local_facing == 5))
824 if ((local_facing == 2) || (local_facing == 3) || (local_facing == 4) || (local_facing == 5) || (local_facing == 6))
829 if ((local_facing == 3) || (local_facing == 4) || (local_facing == 5) || (local_facing == 6) || (local_facing == 7))
834 if ((local_facing == 4) || (local_facing == 5) || (local_facing == 6) || (local_facing == 7) || (local_facing == 0))
839 if ((local_facing == 5) || (local_facing == 6) || (local_facing == 7) || (local_facing == 0) || (local_facing == 1))
851 n_byte2 * local_random = being_get_random(local);
889 static void being_acquire_pathogen(
noble_being * local,
n_byte transmission_type)
894 n_byte2 * local_random = being_get_random(local);
913 being_acquire_pathogen(local,transmission_type);
920 n_byte2 * local_random = being_get_random(meeter_being);
925 being_acquire_pathogen(meeter_being, transmission_type);
945 if (j == IMMUNE_ANTIGENS)
959 static void being_immune_response(
noble_being * local)
962 n_int min_antibodies;
963 n_int max_bits_matched;
964 n_byte2 total_antigens,max_severity;
965 n_byte i,j,k,match,best_match,bits_matched,bit;
966 n_byte2 * local_random = being_get_random(local);
989 if ((immune->
shape_antigen[i] & (1<<(local_random[0]&7))) != 0)
1010 for (bit=0; bit<8; bit++)
1012 if ((match & (1<<bit)) != 0)
1018 if (bits_matched>max_bits_matched)
1020 max_bits_matched=bits_matched;
1043 if (immune->
antibodies[best_match]<255-max_bits_matched)
1054 if (immune->
antigens[i]>being_honor_immune(local))
1056 immune->
antigens[i]-=being_honor_immune(local);
1068 if ((match & (1<<(local_random[0]&7))) != 0)
1070 match ^= (local_random[0]&7);
1074 match |= (local_random[0]&7);
1105 total_antigens+=immune->
antigens[i];
1126 if (((count>>loop) & 1) == 0)
1142 if (parse_requirements == 1)
return 0;
1146 if (parse_requirements == 0)
return 0;
1151 n_genetics comparison = primary[loop] ^ secondary[loop];
1152 addition += being_genetic_count_zeros(comparison);
1175 if (bfcs->
older == 0) success = 1;
1258 if (bfns->
local == 0L)
1262 bfns->
local = local;
1284 if (!local_episodic)
return affect;
1309 "Head",
"Teeth",
"Back",
"Front",
"Left hand",
"Right hand",
"Left foot",
"Right foot"
1314 return body_inventory_description[index];
1319 "Associate",
"Self",
"Mother",
"Father",
"Daughter",
1320 "Son",
"Granddaughter",
"Grandson",
"Sister",
"Brother",
1321 "Maternal Grandmother",
"Maternal Grandfather",
"Paternal Grandmother",
"Paternal Grandson",
"Mother",
1322 "Father",
"Daughter",
"Son",
"Granddaughter",
"Grandson",
1323 "Sister",
"Brother",
"Maternal Grandmother",
"Maternal Grandfather",
"Paternal Grandmother",
1332 sprintf(description,
"ERROR: relationship out of range %d\n",(
int)index);
1335 io_string_write(description, relationship_description[index], &position);
1488 sprintf(number_str,
"%ld", event_type);
1528 n_int string_index = 0;
1533 n_uint days_elapsed,time_elapsed;
1539 if(local_episodic == 0L)
1541 return SHOW_ERROR(
"No episodic description");
1544 if ((local_episodic[index].event>0) &&
1545 being_name_comparison(local_being, local_episodic[index].first_name[0], local_episodic[index].family_name[0]))
1549 switch(local_episodic[index].event)
1554 switch(local_episodic[index].food)
1658 if (local_episodic[index].arg & 1)
1670 being_inventory_string(str, &string_index, local_episodic[index].arg);
1674 being_inventory_string(str, &string_index, local_episodic[index].arg);
1678 being_inventory_string(str, &string_index, local_episodic[index].arg);
1682 being_inventory_string(str, &string_index, local_episodic[index].arg);
1685 being_social_event_string(str, &string_index, local_episodic[index].event, name_str);
1690 if (string_index == 0)
1692 return SHOW_ERROR(
"No string in episodic description");
1695 days_elapsed = current_date - local_episodic[index].
space_time.
date;
1696 if (days_elapsed == 0)
1700 if (time_elapsed < 60)
1702 if (time_elapsed == 0)
1706 else if (time_elapsed == 1)
1710 else if (time_elapsed<5)
1716 sprintf((
char*)str2,
" %d minutes ago", (
int)time_elapsed);
1722 if (time_elapsed<120)
1728 sprintf((
char*)str2,
" %d hours ago", (
int)time_elapsed/60);
1735 if (days_elapsed==1)
1741 sprintf((
char*)str2,
" %d days ago", (
int)days_elapsed);
1747 str[string_index] = 0;
1759 #define NAMES_SURNAMES 16
1760 #define NAMES_FIRST 64
1765 "Adams",
"Baker",
"Brown",
"Davis",
"Evans",
"Green",
"Jones",
"Mason",
1766 "Moore",
"Myers",
"Perry",
"Price",
"Quinn",
"Smith",
"White",
"Young",
1768 "Agnes",
"Aimee",
"Alice",
"Amber",
"Anita",
"April",
"Becky",
"Beryl",
1769 "Carla",
"Chloe",
"Donna",
"Doris",
"Edith",
"Elena",
"Elise",
"Ellen",
1770 "Emily",
"Erika",
"Ethel",
"Faith",
"Fiona",
"Flora",
"Gilda",
"Grace",
1771 "Hazel",
"Helen",
"Hilda",
"Holly",
"Irene",
"Janet",
"Jewel",
"Kacey",
1773 "Kerri",
"Lacey",
"Linda",
"Mabel",
"Madge",
"Mandy",
"Maude",
"Mavis",
1774 "Megan",
"Mercy",
"Misty",
"Molly",
"Nancy",
"Naomi",
"Norma",
"Nydia",
1775 "Pansy",
"Patty",
"Pearl",
"Polly",
"Rhoda",
"Robin",
"Sadie",
"Sally",
1776 "Sarah",
"Tammy",
"Tanya",
"Tilda",
"Tracy",
"Vania",
"Wanda",
"Wilda",
1778 "Aaron",
"Angus",
"Barry",
"Basil",
"Blair",
"Blake",
"Boris",
"Brent",
1779 "Brian",
"Brock",
"Bruce",
"Bruno",
"Byron",
"Casey",
"Cecil",
"Clive",
1780 "Clyde",
"Colin",
"Craig",
"Cyril",
"Damon",
"Darcy",
"David",
"Derek",
1781 "Edgar",
"Edwin",
"Elmer",
"Elroy",
"Elton",
"Errol",
"Felix",
"Floyd",
1783 "Frank",
"Garth",
"Gavin",
"Giles",
"Glenn",
"Grant",
"Henry",
"Homer",
1784 "Isaac",
"Jacob",
"Jason",
"Jesse",
"Keith",
"Kevin",
"Leroy",
"Lloyd",
1785 "Logan",
"Miles",
"Nigel",
"Oscar",
"Peter",
"Quinn",
"Ralph",
"Roger",
1786 "Scott",
"Shawn",
"Simon",
"Trent",
"Tyler",
"Unwin",
"Vance",
"Wayne"
1792 #define NAMES_SURNAMES 64
1793 #define NAMES_FIRST 256
1798 "Adams",
"Allen",
"Bailey",
"Baker",
"Barnes",
"Bell",
"Brooks",
"Brown",
"Butler",
"Clark",
"Cook",
"Cooper",
"Davies",
"Davis",
"Evans",
1799 "Fisher",
"Foster",
"Graham",
"Gray",
"Green",
"Hall",
"Harris",
"Hill",
"Howard",
"Hughes",
"James",
"Jones",
"Kelly",
"King",
"Lewis",
1800 "Long",
"Mason",
"Matine",
"Miller",
"Moore",
"Morgan",
"Munroe",
"Murphy",
"Mutz",
"Myers",
"Nelson",
"Owen",
"Parker",
"Perry",
1801 "Powell",
"Price",
"Quinn",
"Reed",
"Reid",
"Rogers",
"Rose",
"Reis",
"Scrim",
"Smith",
"Taylor",
"Thiel",
"Turner",
"Walker",
"Ward",
1802 "Watson",
"White",
"Wilson",
"Wood",
"Young",
1804 "Ada",
"Agatha",
"Agnes",
"Aileen",
"Aimee",
"Alanna",
"Alda",
"Alice",
"Alina",
"Alison",
"Alma",
"Amanda",
"Amber",
"Andrea",
"Angela",
1805 "Anita",
"Anthea",
"April",
"Ariana",
"Arleen",
"Astrid",
"Audrey",
"Beata",
"Becky",
"Beryl",
"Bess",
"Bianca",
"Blair",
"Blythe",
1806 "Bonnie",
"Brenda",
"Briana",
"Brooke",
"Carla",
"Carly",
"Carmen",
"Cheryl",
"Chloe",
"Coral",
"Daphne",
"Davida",
"Dawn",
"Denise",
1807 "Donna",
"Dora",
"Doris",
"Echo",
"Eda",
"Edana",
"Edith",
"Edlyn",
"Edna",
"Edwina",
"Effie",
"Eileen",
"Elaine",
"Elena",
"Elga",
1808 "Elise",
"Eliza",
"Ella",
"Ellen",
"Eloise",
"Elsie",
"Elvira",
"Emily",
"Emma",
"Erika",
"Erin",
"Estra",
"Ethel",
"Eudora",
"Eunice",
1809 "Faith",
"Fannie",
"Fawn",
"Faye",
"Fedora",
"Fern",
"Fiona",
"Flora",
"Gale",
"Gaye",
"Geneva",
"Gilda",
"Gladys",
"Gloria",
"Grace",
1810 "Gwynne",
"Harley",
"Hattie",
"Hazel",
"Hetty",
"Hilda",
"Holly",
"Honey",
"Hope",
"Ingrid",
"Irene",
"Iris",
"Ivory",
"Ivy",
"Jade",
1811 "Jane",
"Janet",
"Janice",
"Jeanne",
"Jemima",
"Jewel",
"Joan",
"Joanna",
"Joy",
"June",
"Kacey",
"Kara",
"Kate",
"Kay",
"Keely",
"Kelsey",
1812 "Kendra",
"Kerri",
"Kyla",
"Lacey",
"Lane",
"Lara",
"Larina",
"Leanne",
"Leslie",
"Linda",
"Livia",
"Lizzie",
"Lois",
"Lorena",
"Lulu",
1813 "Luna",
"Lynn",
"Mabel",
"Madge",
"Maggie",
"Maia",
"Maisie",
"Mandy",
"Marcia",
"Margot",
"Marnia",
"Mary",
"Maude",
"Maura",
"Mavis",
1814 "Maxine",
"Megan",
"Melody",
"Mercy",
"Meris",
"Merle",
"Miriam",
"Misty",
"Moira",
"Molly",
"Mona",
"Monica",
"Mora",
"Morgan",
"Muriel",
1815 "Myra",
"Myrtle",
"Nancy",
"Naomi",
"Nell",
"Nerita",
"Nina",
"Noelle",
"Nola",
"Norma",
"Nydia",
"Odette",
"Olga",
"Opal",
"Oprah",
"Orva",
1816 "Page",
"Pamela",
"Pansy",
"Patty",
"Pearl",
"Phoebe",
"Polly",
"Quenna",
"Questa",
"Rachel",
"Ramona",
"Regina",
"Rhea",
"Rhoda",
"Rita",
1817 "Robin",
"Rosa",
"Rowena",
"Ruby",
"Ruth",
"Sacha",
"Sadie",
"Salena",
"Sally",
"Salome",
"Sandra",
"Sarah",
"Serena",
"Shana",
"Sharon",
1818 "Sheila",
"Sibley",
"Silver",
"Sirena",
"Talia",
"Tamara",
"Tammy",
"Tanya",
"Tara",
"Tasha",
"Tatum",
"Tess",
"Thalia",
"Thea",
"Thelma",
1819 "Thora",
"Tilda",
"Tina",
"Tracy",
"Trina",
"Trista",
"Tyne",
"Udele",
"Ula",
"Ulrica",
"Ulva",
"Una",
"Unity",
"Ursa",
"Ursula",
"Valda",
1820 "Vania",
"Veleda",
"Vera",
"Verda",
"Violet",
"Vita",
"Wanda",
"Wilda",
"Willa",
"Willow",
"Wynne",
"Zea",
"Zelda",
"Zera",
"Zoe",
1822 "Aaron",
"Abbott",
"Abel",
"Adam",
"Albern",
"Albert",
"Alfie",
"Alfred",
"Alvin",
"Amery",
"Amos",
"Andrew",
"Angus",
"Ansel",
"Arlen",
1823 "Arnold",
"Arvel",
"Austin",
"Axel",
"Baird",
"Barry",
"Basil",
"Bert",
"Blair",
"Blake",
"Boris",
"Brent",
"Brian",
"Brice",
"Brock",
1824 "Bruce",
"Bruno",
"Bryant",
"Buck",
"Bud",
"Burton",
"Byron",
"Calvin",
"Carl",
"Carter",
"Carver",
"Cary",
"Casey",
"Casper",
"Cecil",
1825 "Cedric",
"Claude",
"Clive",
"Clyde",
"Colin",
"Conan",
"Connor",
"Conrad",
"Conroy",
"Conway",
"Corwin",
"Craig",
"Crosby",
"Culver",
1826 "Curt",
"Curtis",
"Cyril",
"Damon",
"Daniel",
"Darcy",
"David",
"Dean",
"Declan",
"Dennis",
"Derek",
"Dermot",
"Derwin",
"Dexter",
1827 "Dillon",
"Dion",
"Dirk",
"Donald",
"Dorian",
"Drew",
"Dudley",
"Duncan",
"Dwayne",
"Dwight",
"Dylan",
"Earl",
"Edgar",
"Edwin",
"Efrain",
1828 "Egbert",
"Elbert",
"Elmer",
"Elroy",
"Elton",
"Elvis",
"Emmett",
"Emrick",
"Ernest",
"Errol",
"Esmond",
"Eugene",
"Evan",
"Ezra",
"Fabian",
1829 "Farley",
"Felix",
"Fenton",
"Ferris",
"Finbar",
"Floyd",
"Foster",
"Fox",
"Frank",
"Gale",
"Galvin",
"Garret",
"Garth",
"Gavin",
"George",
1830 "Gideon",
"Giles",
"Gilroy",
"Glenn",
"Godwin",
"Graham",
"Grant",
"Guy",
"Hadden",
"Hadley",
"Hadwin",
"Hale",
"Hall",
"Hamlin",
"Hardy",
1831 "Harley",
"Hector",
"Henry",
"Herman",
"Homer",
"Howard",
"Hubert",
"Hunter",
"Ian",
"Isaac",
"Isaiah",
"Ivan",
"Ives",
"Jack",
"Jacob",
1832 "Jarvis",
"Jason",
"Jasper",
"Jed",
"Jerome",
"Jesse",
"John",
"Joshua",
"Justin",
"Keaton",
"Keith",
"Kelsey",
"Kelvin",
"Kent",
"Kerry",
1833 "Kevin",
"Kirby",
"Kirk",
"Kit",
"Kody",
"Konrad",
"Kurt",
"Kyle",
"Lamont",
"Landon",
"Lane",
"Lars",
"Lee",
"Leroy",
"Leslie",
"Lester",
1834 "Lionel",
"Lloyd",
"Logan",
"Lowell",
"Lyndon",
"Marcus",
"Marlon",
"Martin",
"Marvin",
"Medwin",
"Melvin",
"Merlin",
"Miles",
"Morgan",
1835 "Morris",
"Morton",
"Murray",
"Neal",
"Nigel",
"Noel",
"Norman",
"Olaf",
"Olin",
"Oliver",
"Oscar",
"Oswald",
"Otis",
"Owen",
"Paul",
1836 "Perry",
"Peter",
"Philip",
"Pierce",
"Quincy",
"Quinn",
"Ralph",
"Rex",
"Riley",
"Rodney",
"Roger",
"Roland",
"Rolf",
"Ronald",
"Rory",
1837 "Ross",
"Roy",
"Rufus",
"Rupert",
"Ryan",
"Samson",
"Samuel",
"Scott",
"Sean",
"Seth",
"Shawn",
"Sidney",
"Simon",
"Sloane",
"Stacy",
1838 "Thomas",
"Toby",
"Todd",
"Tony",
"Trent",
"Trevor",
"Troy",
"Tyler",
"Unwin",
"Vance",
"Victor",
"Walter",
"Warren",
"Wayne",
"Wilbur",
1839 "Willis",
"Wyatt",
"Wylie"
1844 #define FAMILY_NAME_AND_MOD (NAMES_SURNAMES - 1)
1845 #define FIRST_NAME_AND_MOD (NAMES_FIRST - 1)
1847 #define UNPACK_FAMILY_FIRST_NAME(packed_family_name) (packed_family_name & FAMILY_NAME_AND_MOD)
1848 #define UNPACK_FAMILY_SECOND_NAME(packed_family_name) ((packed_family_name / NAMES_SURNAMES)&FAMILY_NAME_AND_MOD)
1849 #define GET_NAME_FAMILY(f0,f1) ((n_byte2)((f0&FAMILY_NAME_AND_MOD)|((f1&FAMILY_NAME_AND_MOD)*NAMES_SURNAMES)))
1970 const n_string state_description[] =
1972 "Sleeping",
"Awake",
"Hungry",
"Swimming",
"Eating",
"Moving",
1973 "Speaking",
"Shouting",
"Grooming",
"Suckling",
1974 "Showing Force",
"Attacking"
1976 n_int string_length=0;
1987 if (state & (1<<(n-1)))
1989 if (string_length > 0)
2021 vect2_d(&location_vector, &facing_vector, rel_vel, 512);
2026 location_vector.
y -= (rel_vel * 200)-100;
2028 location_vector.
x += 500-(rel_vel * 200);
2053 local_select = first;
2058 if (sim->
select != first)
2064 local_select = last;
2155 static void being_brain_probe(
noble_being * local)
2161 if (local_brain == 0L)
return;
2198 local_braincode[position_in_braincode] = (
n_byte)set_value;
2205 local_brain[position_in_brain] = (
n_byte)set_value;
2217 being_immune_response(local);
2223 being_brain_probe(local);
2227 if ((awake == 0) && local)
2236 static void being_create_family_links(
noble_being * mother,
2243 n_byte parent_relation[6];
2244 n_byte child_relation[6];
2248 if (mother==0L)
return;
2270 for (j = 0; j < 2; j++)
2276 if (parent_social_graph)
2278 for (i = 0; i < 2; i++)
2280 parent[2+(j*2)+i] = 0L;
2283 if ((index > -1) && (parent_social_graph != 0L))
2288 parent_social_graph[index].first_name[
BEING_MET],
2289 parent_social_graph[index].family_name[BEING_MET]);
2303 for (j = 0; j < 2; j++)
2309 if (parent_social_graph)
2316 sibling =
being_find_name(sim, parent_social_graph[i].first_name[
BEING_MET], parent_social_graph[i].family_name[BEING_MET]);
2336 for (i = 0; i < 6; i++)
2338 if (parent[i]==0L)
continue;
2374 n_uint compare_distance =
vect2_dot(&difference_vector, &difference_vector, 1, 1);
2375 if (compare_distance < nearest->opposite_sex_distance)
2398 n_uint compare_distance =
vect2_dot(&difference_vector, &difference_vector, 1, 1);
2401 if (compare_distance < nearest->opposite_sex_distance)
2409 if (compare_distance < nearest->same_sex_distance)
2434 n_int social_graph_index;
2436 nearest->
local = local;
2453 if (local_social_graph == 0L)
return;
2458 nearest->
local_social = &local_social_graph[social_graph_index];
2461 if ((social_graph_index>0) &&
2462 (local_social_graph[social_graph_index].entity_type ==
ENTITY_BEING) &&
2482 compare_distance =
vect2_dot(&difference_vector, &difference_vector, 1, 1);
2504 if (
being_awake(local_sim, local_being) == 0)
return;
2507 bls.
local = local_being;
2522 compare_distance =
vect2_dot(&difference_vector, &difference_vector, 1, 1);
2525 if (compare_distance < nearest->opposite_sex_distance)
2537 if ( compare_distance < nearest->same_sex_distance )
2565 nearest->
local = local;
2588 n_uint other_being_distance,
2594 if (other_being != 0L)
2609 if (being_index > -1)
2612 if (local_social_graph)
2622 if (
social_groom(local, other_being, other_being_distance, *awake, familiarity, sim))
2637 squabble_val =
social_squabble(local, other_being, other_being_distance, local_is_female, sim);
2638 if (squabble_val != 0)
2640 *state |= squabble_val;
2647 if ((other_being_distance <
SOCIAL_RANGE) && (being_index>-1))
2650 if (opposite_sex != 0)
2652 *state |=
social_mate(local, other_being, being_index, other_being_distance, sim);
2656 *state |=
social_chat(local, other_being, being_index, sim);
2676 if (local_being == bils->
being)
2691 value.
being = local;
2709 n_int fat_mass, child_mass = 0;
2712 n_int carrying_child = 0;
2725 n_int test_land = 1;
2740 land_vect2(&slope_vector, &az, land, &location_vector);
2742 vect2_add(&looking_vector, &location_vector, &facing_vector);
2752 tmp_speed = ((delta_z + 280) >> 4);
2800 being_turn_away_from_water(local, land);
2816 tmp_speed = (tmp_speed * (
GENE_SWIM(genetics)+8)) >> 4;
2826 tmp_speed = (tmp_speed * (
GENE_SPEED(genetics)+8)) >> 3;
2829 being_follow(sim, local, &nearest);
2833 being_closest(sim, local, &nearest);
2893 if (tmp_speed > 39) tmp_speed = 39;
2894 if (tmp_speed < 0) tmp_speed = 0;
2898 if ((loc_state & BEING_STATE_SWIMMING) != 0)
2908 if (tmp_speed > loc_s) loc_s++;
2909 if (tmp_speed < loc_s) loc_s--;
2910 if (tmp_speed < loc_s) loc_s--;
2911 if (tmp_speed < loc_s) loc_s--;
2933 if (conception_days > 0)
2936 if (today_days > gestation_days)
2942 if (being_child == 0L)
2944 if((sim->
num + 1) < sim->
max)
2951 being_create_family_links(local,being_child,sim);
2964 if (today_days < carrying_days)
2976 child_mass =
GET_M(being_child);
2986 child_mass = (today_days - conception_days) *
BIRTH_MASS / GESTATION_DAYS;
2993 noble_being * mother = being_find_closest(sim, local, 1, 1);
3004 if ((loc_state & BEING_STATE_HUNGRY) != 0)
3006 n_int distance =
vect2_dot(&mother_vector, &mother_vector, 1, 1);
3033 being_immune_seed(mother, local);
3045 if ((carrying_child==0) && (local_is_female ==
SEX_FEMALE))
3069 for (territory_index=0; territory_index<
TERRITORY_AREA; territory_index++)
3089 n_byte2 * local_random = being_get_random(local);
3090 n_uint ch,i,most_similar_index,diff,min,actor_index;
3100 #ifdef RANDOM_INITIAL_BRAINCODE
3103 being_random3(local);
3111 #ifdef RANDOM_INITIAL_BRAINCODE
3114 being_random3(local);
3132 most_similar_index=0;
3145 if (signed_diff < 0)
3147 diff = -signed_diff;
3156 most_similar_index = i;
3174 n_int samples=0,found=0;
3177 n_byte2 * random_factor = being_get_random(local_being);
3180 local_random[0] = random_factor[0];
3181 local_random[1] = random_factor[1];
3188 if ((mother_family_name==0) && (father_family_name==0))
3190 mother_family_name =
3192 (
math_random(local_random) & FAMILY_NAME_AND_MOD));
3193 father_family_name =
3195 (
math_random(local_random) & FAMILY_NAME_AND_MOD));
3199 possible_family_name =
3203 while ((found == 0) && (samples < 2048))
3212 possible_family_name =
3214 (
math_random(local_random) & FAMILY_NAME_AND_MOD));
3217 if (samples == 1024)
3220 possible_family_name =
3229 possible_family_name =
3231 (
math_random(local_random) & FAMILY_NAME_AND_MOD));
3234 being_set_first_name(local_being,possible_first_name);
3241 for (i = 0; i < number; i++)
3270 value[loop] |= 1 << loop2;
3297 if (local_social_graph == 0L)
3299 return SHOW_ERROR(
"Social memory not available");
3301 if (local_episodic == 0L)
3303 return SHOW_ERROR(
"Episodic memory not available");
3311 if (brain_memory != 0L)
3317 return SHOW_ERROR(
"Brain memory not available");
3331 being_immune_init(local);
3358 being_set_random(local, random_factor);
3359 being_random3(local);
3360 being_random3(local);
3367 being_set_random(local, being_get_random(mother));
3369 being_random3(local);
3371 being_set_random1(local, being_get_random(mother)[0]);
3373 being_random3(local);
3375 being_set_random1(local, land->
time);
3377 being_random3(local);
3381 NA_ASSERT(random_factor,
"Random factor not set");
3383 return SHOW_ERROR(
"No correct being interface provided");
3387 being_random3(local);
3417 being_random3(local);
3424 being_random3(local);
3434 being_random3(local);
3437 being_random3(local);
3442 being_facing_init(local);
3450 being_random3(local);
3470 being_random3(local);
3473 being_random3(local);
3474 being_random3(local);
3478 being_random_genetics(mother_genetics, gene_random, 0);
3480 being_random3(local);
3483 being_random3(local);
3484 being_random3(local);
3485 being_random3(local);
3489 being_random_genetics(father_genetics, gene_random, 1);
3490 being_random3(local);
3494 being_set_unique_name(beings, number, local, 0L, 0L);
3519 being_set_unique_name(beings, number, local,
3536 being_random3(local);
3549 being_set_brainatates(local, 0, 171, 0, 146);
3550 being_set_brainatates(local, 1, 86, 501, 73);
3563 n_int conductance = 5;
3564 n_int *max_honor = data;
3565 if (local_honor >= 254)
3583 vect2_d(&location_vector, &facing_vector, local_s, 512);
3598 land_vect2(&slope_vector, &local_z,land, &location_vector);
3600 delta_z =
vect2_dot(&slope_vector,&facing_vector,1,96);
3601 delta_energy = ((512 - delta_z) * local_s)/80;
3608 delta_energy = ((delta_energy * delta_energy) >> 9);
3614 delta_e += (delta_energy + 10 - insulation) >> 3;
3625 delta_energy = ((delta_energy * delta_energy) >> 9);
3635 delta_e += (7) >> 2;
3641 delta_e -= ((
GENE_HAIR(genetics)*delta_e)>>conductance);
3642 if (delta_e < 1) delta_e = 1;
3648 if (land->
time == 0)
3652 if (age_in_years > 29)
3667 static n_int being_remove_internal_value = 0;
3668 static n_int being_remove_external_value = 0;
3672 return being_remove_internal_value;
3677 being_remove_external_value = value;
3684 local_sim->
ext_death(local_being,local_sim);
3720 if (being_remove_external_value)
3723 while(being_remove_external_value);
3726 being_remove_internal_value = 1;
3732 local_sim->
num = (*brls)->count;
3733 if ((*brls)->selected_died)
3745 if ((*brls)->count == 0)
3747 (void)
SHOW_ERROR(
"No Apes remain start new run");
3750 being_remove_internal_value = 0;