Thursday, May 8, 2008

ALGORITHM OF SLEEP

I came with this idea while i was half asleep...my “ALGORITHM OF SLEEP”
awesome isn't it well...have first look at it
step 1 : start (go to bed)
step 2 : close your eyes
step 3: 1 picture will come to your mind (for sure....i can bet 25 crore units)
step 4: think about it..keep on thinking and slowly slowly slowly all your senses (i mean most of them)
will sleep to!!!
step 5: brain is getting active and searches for hidden sentiments and on finding some..it create
characters for the story which you and I call as dream!! (this human brain...legendary)
step 6: NOTE :: all steps are for general people........from here on this theory applies to me :)
step 7: my “active” brain finds some disturbance if any.....in my sleep,which registers to it after the
process of disturbing continues for at least an hour.
step 8 : in my dream,then, that thing will happen...for example...if my phone is ringing...then there will
be a phone call (somehow) in my dream, provided the enthusiast caller made at least
(60 min/1.5 min) calls.
Step 9 : my brain then checks if there are other people at home
//a code snippet ;)
int sleepHours = 6,sleepHourCounter=0;
int sleepStartTime,sleepEndTime;
string time=checkSystemTime();
//extract number and other detail using regular expression
int timeHour = extractHour(time);
string AMorPM = extractAMorPM(time);
if(timeHour=>4 && timeHour <= 8 && (AMorPM.compare(regularAMorPM))==1) // 1 implies PM
{
sleepStartTime=timeHour;
sleepEndTime=timeHour+2;
}
elseif(timeHour >8 timeHour<12 )
{
if(personIsSleepin() == true)
{
endSleep();
}
}
else
{
sleepStartTime = timeHour;
sleepEndTime = timeHour +6;
}
for(;sleepHourCounter{
if(familyMemberPresent()==true)
{
cutoffDisturbance();
activateSleep();
}
else
{
waitForAnHour();
if(checkDisturance() == true)
{
spellSomething(); /* like “Oh God”....string to be passed should be mentioned..this call is overrided so worry not even if I don't utter anything */
checkPerson=personDisturbing();
if(checkPerson != dear)
{
spellCurse(); // in mind,of course
doRegularStuff();
getRidOfPerson();
resumeSleeping();
}
else
{
endSleepingProcess();
doRegularDearStuff();
entertainPerson();
backToRegularActivity();
}
}
else //nothing like it!!
{
continueSleeping();
}
}
ufff..................this code is not compiled ( it won't run anyway,so mistakes are liable to exist , pardon me if any found ........syntactic or semantic :) )
ye code likh toh meri neend hi bhaag gayi !!!
i am sure,this is first piece of anything related to computer since i have written since i joined engineering and i am sure many would agree to this fact !!!
well if algorithm is not clear(as it is, to me)
go to sleep........sab “clear” ho jayega!!
gunnie !!!
wait wait wait.....if alive
step 10 : if(checkBrainStatus() == 1)
{
MessageBox.Show(“ You are GOD”);
}
else
{
MessageBox.Show(“hota hai hota hai..meri coding dekh k achhe achhon ka dimaag
kharab ho jata hai...tum kya cheez ho!! ”);
}
int checkBrainStatus()
{
if( checkMonitorStaus() == true) // if it is not broken,out of anger
{
if(checkPersonBrainLivingOrDead()==true) )
return 1;
}
else
return 0;
}




I had plans to have a flowchart rather than step by step algorithm but it turned out to be really good.


Comments needed !!

4 comments:

Vaibhav Jain said...

me to chakra gaya ye padh ke... itni coding project me bhi kar diya karo... mast coder ho tum to... but haan.. tumne sleep pe coding ki hai, me isko padh ke sachmuch sleep kar gaya :P

gaurav said...

Mast hai sir, neend ka bhi algo , duniya hi tech hoti ja rahi hai bus ab iski complexity nikal ke post kar do mein tumhari google mein approach lagwata hun :P humko wahan ki tshirts de dena bus and jagne ka algo bhi likh do , law of nature ,everything has an inverse. . .

Akhil said...
This comment has been removed by a blog administrator.
Akhil said...
This comment has been removed by the author.