--- /dev/null
+<?php\r
+//This will draw the ASCII neverending sinus curve.\r
+//Writen by (c) Harvie in 2oo6\r
+//This is script for PHP CLI (Not WebPage).\r
+//You can port it to web by replacing "/n" by "<br>/n"\r
+\r
+//Settings:\r
+$start = -3; //0 //First X\r
+$zero = 0; //Zero line\r
+$stop = 0.5; //Last X\r
+$step = 0.1; //0.1 //Increase X on every line by this number\r
+$reset = "0"; //When X >= reset, then it will be reseted to $resetto (use "" to disable reset).\r
+$resetto = "0.1"; //$resetto\r
+$zoom = 1; //1 //This will repeat every line few times\r
+$sleep = "15000"; //15000 - Wait between lines in microseconds\r
+$line = (" "); // " " // ":" //chr ( 176 ) //This is the string, that will be repeated from display start to the curve (curve inlay).\r
+$endline = ("+\n"); // "#\n" // ".\n" //chr ( 219 )."\n" //This is the string, that will be printed at end of every line (curve outline).\r
+\r
+//Function:\r
+//You can specify your function here:\r
+function func($x) {\r
+\r
+$offset = 20; //1.1 //1 //0 -> Zero offset will draw only half of sin curve.\r
+$width = 1; //20 //35 //40 //This will stretch every line.\r
+\r
+$y = ( ( (3 / $x) + $offset) * $width );\r
+//echo("Debug: ".$x." ".$y." "); //Debug\r
+return ($y);\r
+\r
+}\r
+\r
+//Code:\r
+echo ("[SinusCurve]-[c][Harvie][2oo6]\n\n");\r
+echo (" | y\n");\r
+echo ("-|--------------------------------------------->\n");\r
+echo ("x|\n");\r
+echo (" V\n\n");\r
+\r
+sleep(2);\r
+\r
+//Set x to $start:\r
+$pos = $start;\r
+\r
+//Drawing:\r
+while(1) {\r
+\r
+ //usleep($sleep); //Wait in microseconds\r
+ \r
+ $znaku = func($pos);\r
+ \r
+ $zoom2 = $zoom;\r
+ while ($zoom2 > 0) {\r
+ \r
+ $znaku2 = round($znaku); //It looks better after round ;)\r
+ while ($znaku2 > 0) {\r
+ echo $line;\r
+ $znaku2 = ($znaku2 - 1);\r
+ }\r
+ //echo(" ".$pos); //Debug\r
+ echo ($endline);\r
+ \r
+ $zoom2 = ($zoom2 - 1);\r
+ }\r
+ \r
+ //Draw: Y axis:\r
+ //echo(" ".$pos."\n"); //Debug\r
+ if ($pos == $zero) {\r
+ echo("-+------------------------------------------------------------>\n");\r
+ }\r
+ \r
+ //Increase X:\r
+ $pos = ($pos + $step);\r
+ \r
+ //Reset (for neverending curves, etc...):\r
+ if ( ($pos >= $reset) && ($reset != "") ) {\r
+ $pos = $resetto;\r
+ }\r
+ \r
+ //Stop if $stop is reached:\r
+ if ($pos > $stop) {\r
+ die();\r
+ }\r
+\r
+}\r
+?>\r