<?php // Simple example of plain text output. // Get the limit (number of rows) from the query string, default 10. $lim = $_SERVER['QUERY_STRING']; if(!$lim) $lim = 10; // Inform the system we're generating plain text. header ("Content-type: text/plain"); // Some silly title info. echo " The Wandering Star\n [$lim lines]\n"; echo " (Reload for a new path.)\n\n"; // Create a wandering *. $row = 0; $col = 0; echo '*'; while(1) { // Choose a new row and column. $oldrow = $row; $oldcol = $col; $rand = rand(1,3); $row += $rand % 2; if($rand > 1) $col++; // We've generated enough rows. if($row >= $lim) break; // Move to the right spot and print a *. if($row > $oldrow) { echo "\n"; for($i = 0; $i < $col; ++$i) echo ' '; } echo '*'; } ?>