Pseudocoded

$brain->viewSource()

Persistence

Contributed by Vijay

while (true)
{
       $scenario = $brain->generate_idea ();
       $code = $brain->convert_to_code ($scenario);
 
       $pseudocoded->submit ($code);
 
       if ( $pseudocoded->accepts ($code) )
       {
               $me->set_mood("happy");
               exit;
       }
}

When it’s OK to kill someone

if ( $person->isAttacking( $self ) )
    return true;
 
if ( $self->location == 'WarZone' && $person->isEnemy() )
    return true;
 
if ( $self->location == 'MovieTheater' &&
        $movie->isPlaying() &&
        $movie->rating >= 3 &&
        $movie->ticket->cost >= 10.00 &&
        $person->isTalkingOnCellPhone() &&
        $person->volume > 30dB
            return true;

Life begins

window.onload = function() {
 
    new PeriodicalExecuter( heartbeat, 0.85 );
 
    new PeriodicalExecuter( breathe, 3 );
 
    new PeriodicalExecuter( blink, 5 );
 
    new PeriodicalExecuter( swallow, 60 );
 
    new PeriodicalExecuter( fart, 6200 );
 
    new PeriodicalExecuter( pee, 14400 );
 
    new PeriodicalExecuter( eat, 28800 );
 
    new PeriodicalExecuter( sleep, 86400 );
}

Who to invite to your poker game

 
$person->checkPokerDB( 'http://pokerdb.thehendonmob.com/' );
 
if ( $person->prizeMoney > 0 )
    return false;
 
 
$person->searchForbes( 'http://www.forbes.com/lists/' );
 
if ( $person->ForbesRank > 0 )
    return true;
 
 
$person->testARSE( 'http://electricpulp.com/guykawasaki/arse/' );
 
if ( $person->ARSEScore > 15 )
    return false;

Happy New Year

$year++;
 
foreach ( resolutions( $year - 1 ) as $old_resolution ) {
 
    $new_resolution = clone($old_resolution);
    $new_resolution->year = $year;
}

Little Richard

$person = new Person('Richard Penniman');
 
$person->rename('Little Richard');
 
while ( exists( $person ) ) {
 
    $person->scary++
}

THEN
Little Richard in the 1950s

NOW
Little Richard Today

How fast to drive

$speed = $limit;
 
if ( $bank->balance < $citation->fine ) 
    $speed -= 5;
 
if ( $age > 25 && $age < 70 )
    $speed += 10;
 
if ( $car->year > 2007 )
    $speed += 20;
 
if ( see( $cop ) )
    $speed = $limit - 5;

Dealing with abusive clients

Contributed by Douglas Karr

if ( $client->behavior == 'abusive' ) {
 
    if ( $company->profits < 0 ) {
 
        foreach ( $company->employees() as $employee ) {
 
            $employee->frustration++;
        }
    }
    else {
 
        $client->delete();
    }
}

Now taking submissions

$last_post = array_pop( $blog->posts() );
 
if ( time() - $last_post->date > days(120) ) {
 
    $form = new SubmissionForm;
 
    $form->url = 'http://www.pseudocoded.com/submit/';
 
    $form->launch();
 
    while ( ! $form->entries() ) {
 
        foreach ( $blog->readers() as $reader ) {
 
            $blog->author->beg( $reader );
        }
    }
}

We can’t ever decide where to go for lunch

set_time_limit(600);
 
pcntl_signal(SIGTERM, "timeIsUp");
 
$first = true;
while (true) {
 
    if ($first)
        print "Where do you want to go?\n";
    else
        print "I don't know.  Where do you want to go?\n";
 
    $first = false;
}
 
function timeIsUp($signo) {
    goto("Subway");
}