Program For a Good Day

//##########################################
//Program for a good day
//version 1.0

//##########################################
//This function is called by the system whenever 
//self-awareness activates - its contents can be customized.
//If this function is not called frequently enough,
//run meditation routine
func selfAware()
{
	//this is a good opportunity to poll the emotional state
	currentMood = getCurrentMood()
	if(currentMood != pleasant)
		improveMood()
}

//##########################################
//activeThoughts is a system-populated array
//containing all thoughts currently in mind
func improveMood()
{
	foreach(thought in activeThoughts)
	{
		emotionalIntensity = getEmotionalIntensity(thought)
		isPleasant = determineDelightfulness(thought)
		
		if(emotionalIntensity > 0 && !isPleasant)
			defuseThought(thought)
	}
			
	generatePleasantThoughts()
}

//##########################################
func getCurrentMood()
{
	currentMood = null
	
	if(stressLevel == high)
		currentMood = unpleasant
	else if(aggravationLevel == high)
		currentMood = unpleasant
	else if(mouth != smiling || mouth != neutral)
		currentMood = unpleasant
	else if(posture != relaxed)
		currentMood = unpleasant
	else
		currentMood = pleasant
		
	return currentMood
}

//##########################################
func getEmotionalIntensity(thought)
{
	intensity = 0
	
	if(body == tense)
		intensity++
	
	if(gaze == focused)
		intensity++
		
	return intensity
}

//##########################################
func determineDelightfulness(thought)
{
	if(mind + thought == delight)
		return pleasant
	else
		return unpleasant		
}

//##########################################
func defuseThought(thought)
{
	isEasilyDismissed = dismissThought(thought)
	while(!isEasilyDismissed)
	{
		hasFlaw = findFlaw(thought)
		if(!hasFlaw)	
			imaginePositiveAlternative()
	}	
}

//##########################################
func generatePleasantThoughts()
{
	goodThoughtsArray = recallPastPleasantThoughts(5)
	foreach thought in goodThoughtsArray
	{
		visualizeThought(thought)
	}
}

//##########################################
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s