Re: Sad PHP Poem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2006/6/26, Martin Alterisio <malterisio777@xxxxxxxxx>:

<offtopic type="slightly offtopic" class="poetic literary">

A sad poem of an algorithm where solitude brought excessive use of cpu
cycles and memory allocation for redundant data (it copied over and over
again the same image till all memory was filled with it)

------------------------------

$timeWaiting = 0;
while (!$you->near($me)) {
  $me->thinkAbout($you);

  switch (true) {
    case $timeWaiting < 5:
      $me->wait($you);
      break;

    case $timeWaiting < 10:
      $me->worry();
      break;

    case $timeWaiting < 20:
      $me->lookFor($you) ;
      break;

    case $timeWaiting < 40:
      $me->worry();
       $me->lookFor($you) ;
      break;

    case $timeWaiting < 80:
      $me->worry();
       $me->cry();
       $me->lookFor($you) ;
       $me->lookFor($you) ;
       $me->lookFor($you) ;
      break;

    case $timeWaiting < 160:
      $me->worry();
       $me->cry();
       $me->drink();
       $me->lookFor($you) ;
       $me->lookFor($you) ;
       $me->lookFor($you) ;
      $me->thinkAbout($you);
       $me->thinkAbout($you);
       $me->cry();
       $me->lookFor($you) ;
       $me->lookFor($you) ;
       $me->drink();
       $me->drink();
       break;

    default:
      throw new CantLiveWithoutYou();
      die("alone");
  }

  $timeWaiting++;
}

$me->happy = true;

------------------------------

I hope you enjoyed the poem and the fact that I didn't ask you to fix it
or find the bug in it =D

PD: Run in your web server at your own risk.

</offtopic>


I guy over here completed the code to allow its execution
http://devzone.zend.com/node/view/id/576 (see the comments).

---

Then, I having trouble with this code, would you be so kind to look at it:

<code>
// He says he did it, but he's crazy. Who knows...
$poem->author = new Person("Martin Alterisio");
// TO DO: Person might not be the proper class here. Check that.

foreach (Person::$all as $you) {
 if ($you->like($poem)) {
   $poem->author->thank($you);
 } else {
   // TO DO: Spread the geekness



   // On second thought, maybe that's not a good idea
 }
}
</code>

That's all folks. Coming up next: an innovative realistic soccer simulation
game: "Fix the World Cup". Everything from bribing a referee to fixing the
team sorting. Do you lack the morality to make your team the world champion
by any means necessary? Take this chance to prove it! .... (just joking...
really.... but it would be a good game, wouldn't it?)

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux