the complete c++ sourcecode of human life
----------------the body-----------------
//----------------------------------------// //* program: lifecycle.exe // //* author: god // //* co-author: devil // //* this file: cycle.cpp (main program) // //* version: 0.84-3-beta // //----------------------------------------//
#include < io.h>
#include < sys.h>
#include < math.h>
#include "cycle.hpp"
void main()
{ long int hc; // counter for all humans int i,j,k; // multi-use ints (looping etc.)
// fill all human with random and standards
for (hc=0;hc < MAXHUMAN;++hc)
{
human[hc].isdead=TRUE;
human[hc].age=0;
human[hc].dayage=random(0,DAYSPERYEAR);
human[hc].haspartner=FALSE;
human[hc].hungry=random(0,100);
human[hc].horny=random(0,100);
human[hc].feelwarm=random(0,100);
human[hc].needlove=random(0,100);
human[hc].needplaying=random(0,100);
human[hc].needsleep=random(0,100);
human[hc].needtoilet=random(TRUE,FALSE);
human[hc].partner=NULL;
human[hc].parents=NULL;
human[hc].someone=NULL;
human[hc].teddy=NULL;
}
// now start timer and cycle over every human
// init timer
minute=0;
day=0;
year=0;
daythisyear=0;
// main cycling routine (every minute every human till ENDOFDAYS)
while (day < ENDOFDAYS)
{
// care on time
++minute
if (minute > MINUTESPERDAY) { ++day; ++daythisyear; minute=0; }
if (daythisyear > =DAYSPERYEAR) { daythisyear=0; ++year; }
// bring some new humans to life
for (i=0;i < BORNPERMINUTE;++i)
{
bool abort=FALSE;
for (j=0;j < MAXHUMAN&&!abort;++j)
{
if (human[j].isdead)
{
abort=TRUE;
human[j].isdead=FALSE;
human[j].age=0;
}
}
}
// now check each humans data and behaviour
for (hc=0;hc < MAXHUMAN;++hc)
if (!human[hc].isdead)
{ // about age
if (!minute) ++human[hc].dayage; if (human[hc].dayage>DAYSPERYEAR) { ++human[hc].age; human[hc].dayage=0; }
// age specific behaviour
if (human[hc].age<3) human[hc].actasbaby();
if (human[hc].age>2&&human[hc].age<12) human[hc].actaschild();
if (human[hc].age>11&&human[hc].age<18) human[hc].actasteen();
if (human[hc].age>17) human[hc].actasadult();
// about partnership
if (!human[hc].haspartner&&human[hc].age>14) human[hc].partner=human[hc].searchpartner();
}
// let some of them die (more to older ones)
for (i=0;i<DYINGPERMINUTE;++i)
{
k=0;
j=random(0,MAXHUMAN);
while (!k) {
if (!human[j].isdead) { if (human[j].age<10&&random(0,100)>98) human[j].isdead=TRUE; else if (human[j].age<20&&random(0,100)>95) human[j].isdead=TRUE; else if (human[j].age<30&&random(0,100)>85) human[j].isdead=TRUE; else if (human[j].age<40&&random(0,100)>75) human[j].isdead=TRUE; else if (human[j].age<50&&random(0,100)>60) human[j].isdead=TRUE; else if (human[j].age<60&&random(0,100)>50) human[j].isdead=TRUE; else if (human[j].age<70&&random(0,100)>40) human[j].isdead=TRUE; else if (human[j].age<80&&random(0,100)>20) human[j].isdead=TRUE; else if (human[j].age<90&&random(0,100)>10) human[j].isdead=TRUE; else if (human[j].age<100&&random(0,100)>5) human[j].isdead=TRUE; else if (human[j].age<110&&random(0,100)>3) human[j].isdead=TRUE; else if (human[j].age<120&&random(0,100)>2) human[j].isdead=TRUE; else human[j].isdead=TRUE;
if (human[j].isdead) k=TRUE; }
} } // end of dying
} // end of - while (day < ENDOFDAYS) - main cycling routine
} // end of - main() -
//-------------------------------------------------------------------------
// age specific functions
//-------------------------------------------------------------------------
void Thuman::actasbaby()
{
horny=0;
hungry+=5;
needsleep+=5;
needplaying+=5;
feelwarm-=5;
needlove+=5;
if (hungry>30) { while (!checkreaction(parents)) scream(); } else { eat(); scream(); }
if (needtoilet) { while (!checkreaction(parents)) scream(); } else { shit(); scream(); }
if (feelwarm<80) { while (!checkreaction(parents)) scream(); } else scream();
if (needlove>30) { while (!checkreaction(parents)) scream(); } else scream();
if (needplaying>30) { while (!checkreaction(parents)) scream(); } else { play(); scream(); }
if (needsleep>25) sleep(); // don't scream
}
//-------------------------------------------------------------------------
void Thuman::actaschild()
{
horny=0;
hungry+=7;
++needsleep;
--feelwarm;
needplaying+=7;
needlove+=4;
if (hungry>50) { say("i'm hungry");
while (!checkreaction(parents))
waitonanswer(parents);
eat();
say(""); }
if (needtoilet) { say("wanna go on toilet");
while (!checkreaction(parents))
waitonanswer(parents);
shit(); }
if (feelwarm<20) { say("it's cold");
while (!checkreaction(parents))
waitonanswer(parents); }
if (needlove>30) { say("where's my teddy, and mom, and dad?");
while (!checkreaction(parents)&&!checkreaction(teddy))
waitonanswer(someone); }
if (needplaying>30) { say("where's my teddy? and mom? and dad?");
while (!checkreaction(parents)&&!checkreaction(teddy))
waitonanswer(someone); }
if (needsleep>40) sleep();
}
//-------------------------------------------------------------------------
void Thuman::actasteen()
{
if (age<13) horny=0; else horny+=2;
hungry+=7;
++needsleep;
--feelwarm;
needplaying+=7;
needlove+=4;
if (hungry>40) { say("i'm hungry");
while (!checkreaction(parents))
waitonanswer(parents);
eat();
say("more!"); }
if (needtoilet) { say("wanna go on toilet");
while (!checkreaction(parents))
waitonanswer(parents);
shit(); }
if (feelwarm<20) { say("it's cold");
while (!checkreaction(parents))
waitonanswer(parents);
putclotheson();
say("don't like that trouser"); }
if (needlove>30) { say("where's my mom, and dad?");
while (!checkreaction(parents))
waitonanswer(&parents);
kiss(teddy); }
if (needplaying>30) { say("where's my gun");
while (!checkreaction(parents))
waitonanswer(parents);
play();
say("you're dead"); }
if (horny>50) { say("?!?!");
dosomethingstupid();
dosomethingstupid();
if (!checkreaction(someone))
{ masturbate(); say("!!?"); } }
if (needsleep>50) sleep();
}
//-------------------------------------------------------------------------
void Thuman::actasadult()
{
if (age<25) horny+=8; else horny+=3
hungry+=2;
needsleep+=2;
--feelwarm;
++needplaying;
needlove+=3;
if (hungry>60) if (haspartner)
{ say("let's go to the restaurant, i'm hungry");
if (!checkreaction(partner))
eat(); };
else eat();
if (needtoilet) { say("i'm going on toilet"); shit(); }
if (feelwarm<20) { say("it's cold");
putclotheson(); }
if (needlove>30) { if (haspartner) { say("give me a kiss");
if (!checkreaction(partner)) dosomethingstupid();
else kiss(partner); }
else { dosomethingstupid();
partner=searchpartner(); }
if (needplaying>50) { say("let's play chess or something");
if (!checkreaction(someone)) playalone(); }
if (haspartner)
{ if (horny>50) { say("you're looking beautiful");
if (checkreaction(partner)) kiss(partner); else dosomethingstupid(); }
if (horny>80) { say("you're looking very beautiful and even more better without your clothes");
if (checkreaction(partner)) havesex(partner) else dosomethingverystupid(); }
if (horny>90) { say ("can we have sex right here in the kitchen?");
if (checkreaction(partner)) havesex(partner); else masturbate(); }
}
else if (horny>70) masturbate();
if (needsleep>60) sleep();
}
//--------------------------------------------------------------------------------
// action functions
//----------------------------------------------------------------------------
void Thuman::scream() { say("rabaaaaaah"); };
//----------------------------------------------
void Thuman::eat() { hungry=0; };
//------------------------------------------
void Thuman::say(char* cp) { out(cp); };
//---------------------------------------------
void Thuman::play() { dosomethingstupid();
--needplay; };
//-------------------------------------------------
void Thuman::playalone() { dosomethingstupid();
--needplay; };
//--------------------------------------------------
void Thuman::shit() { needtoilet=0; };
//--------------------------------------------------
bool Thuman::reaction() { return(random(TRUE,FALSE)); };
//-------------------------------------------
Thuman* Thuman::searchpartner() { dosomethingstupid();
if (checkreaction(someone))
{ haspartner=TRUE; return someone; }
else return NULL; };
//----------------------------------------------------------
void Thuman::kiss(Thuman* hp) { dosomethingstupid();
--horny;
--needlove;
if (hp!=partner) say("i'm so sorry); };
//---------------------------------------------------------------
void Thuman::havesex(Thuman* hp) { dosomethingstupid(); horny=0;
needlove-=10;
if (hp!=partner) say("i'm so sorry, but that was nice); };
//---------------------------------------------------------
void Thuman::masturbate() { dosomethingstupid();
horny=0;
say("uhh, that was good"); };
//------------------------------------------------------
void Thuman::waitonanswer(Thuman* hp) { while (!checkreaction(hp)) dosomethingstupid(); };
//----------------------------------------------------------------
void Thuman::checkreaction(Thuman* hp) { return hp->reaction(); };
//------------------------------------------------
void Thuman::dosomethingstupid() { int i=1;
while(i)
{ i=random(0,500);
++i;
say("");
--i; } };
//------------------------------------------------
void Thuman::dosomethingverystupid() { int i;
for(i=0;i!=10;++i) dosomethingstupid(); };
//------------------------------------------------
void Thuman::putclotheson() { dosomethingstupid();
feelwarm+=10; };
//------------------------------------------------
void Thuman::putclothesoff() { dosomethingstupid();
feelwarm-=10; };
//------------------------------------------------
void Thuman::sleep() { --needsleep; };
// that's all
|