Skip to content

Instantly share code, notes, and snippets.

@kovshenin
Created January 16, 2012 11:11
Show Gist options
  • Save kovshenin/1620320 to your computer and use it in GitHub Desktop.
Save kovshenin/1620320 to your computer and use it in GitHub Desktop.
A birthday gift I got from my brother :)
<?php
require 'classes/household.php';
require 'classes/birthday.class.php';
require 'classes/birthday.boy.class.php';
require 'classes/friend.php';
$K = new Birthday_Boy();
foreach ( $K->check_phone()->check_im()->check_social() as $greetings ) {
if ( $greetings->sender->location == 'Moscow' ) {
$bring_present = $greetings->sender->got_present_last_year();
$invited_friends []= $K->invite_over( $greetings->sender, $bring_present );
} else {
$thank_you_notes = $K->get_thanks_notes();
$K->respond( $greetings, $thank_you_notes[array_rand( $thank_you_notes )] );
}
}
$birthday_party = Birthday::party( $invited_friends );
$presents = array();
$birthday_party->fetch_presents( $presents );
if ( sizeof( $presents ) ) ++$K->sadness;
else {
foreach ( $presents as $present ) {
$present = $K->open( $present );
if ( $present->health_after_opening() < 50 ) {
--$K->excitement_level;
--$K->strengh;
if ( !$K->scissors ) $K->scissors = Household::get( 'Scissors' );
}
if ( Household::get( $present->get_class() ) ) continue;
if ( $present->get_awsomeness_score() < 2 ) Household::get( 'Recycling_Bin' )->put( $present );
else {
if ( $present->is_funny() ) $K->laugh();
if ( $present->is_food() ) {
if ( $present->get_class() == 'Bacon' ) $K->eat( $present );
else Household::get( 'Fridge' )->put( $present );
}
}
++$K->hapiness;
}
}
unset( $presents );
$birthday_party->set_table( Household::get( 'Salads' ) );
$birthday_party->set_table( Household::get( 'Drinks' ) );
$birthday_party->set_table( Household::get( 'Food' ) );
$birthday_party->set_table( Household::get( 'Desert' ) );
$birthday_party->set_playlist( $K->get_favourite_playlist() )->play();
while ( $birthday_party->is_running() ) {
foreach ( $birthday_party->get_friends() as $friend ) {
$friend->congratulate( $K );
$friend->enjoy( $birthday_party->get_table() );
$friend->enjoy( $birthday_party->playlist->get_current_track() );
while( !$friend->drunk ) $friend->grab( $birthday_party->get_random_drink() )->drink();
}
foreach ( $K->get_family() as $family ) {
if ( $family->get_name() == 'Gennady' or $family->get_name() == 'Nastya' ) {
special_message( $K );
} else $family->congratulate( $K );
if ( $family->location != $birthday_party->location ) continue;
$family->enjoy( $birthday_party->get_table() );
if ( $family->age < 25) $family->enjoy( $birthday_party->playlist->get_current_track() );
}
if ( $birthday_party->get_neighbour()->has_called_police() ) $birthday_party->end();
}
$birthday_party->get_table()->clean( $K->get_wife() );
unset( $birthday_party );
while ( date('Y-m-d') != '2012-01-15' ) sleep( 60 );
unset( $K );
function special_message( &$K ) {
$message = "
Happy Birthday Konstantin!
* * *
*|_*|_*|*_
.-'`|* |* |*| `'-.
|`-............-'|
| |
\ _ .-. _ /
,-|'-' '-' '-' '-'|-,
/` \._ _./ `\
'._ `""""""""""` _.'
jgs `''--..........--''`
from Gennady and Nastya!"
$stats []= $K->hapiness;
$stats []= $K->love;
$stats []= $K->prosperity;
$stats []= $K->work_that_is_enjoyable;
$stats []= $K->luck;
$stats []= $K->knowledge;
$stats []= $K->fun;
foreach ( $stats as $index => $stat ) {
++$stats[$index];
}
$wishes = &$stats;
$K->send_message( $message, $wishes );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment