added PKGBUILD for openssh-dnssec
[mirrors/Programs.git] / php / skripty / lomena.php
CommitLineData
8de51304
H
1<?php\r
2//This will draw the ASCII neverending sinus curve.\r
3//Writen by (c) Harvie in 2oo6\r
4//This is script for PHP CLI (Not WebPage).\r
5//You can port it to web by replacing "/n" by "<br>/n"\r
6\r
7//Settings:\r
8$start = -3; //0 //First X\r
9$zero = 0; //Zero line\r
10$stop = 0.5; //Last X\r
11$step = 0.1; //0.1 //Increase X on every line by this number\r
12$reset = "0"; //When X >= reset, then it will be reseted to $resetto (use "" to disable reset).\r
13$resetto = "0.1"; //$resetto\r
14$zoom = 1; //1 //This will repeat every line few times\r
15$sleep = "15000"; //15000 - Wait between lines in microseconds\r
16$line = (" "); // " " // ":" //chr ( 176 ) //This is the string, that will be repeated from display start to the curve (curve inlay).\r
17$endline = ("+\n"); // "#\n" // ".\n" //chr ( 219 )."\n" //This is the string, that will be printed at end of every line (curve outline).\r
18\r
19//Function:\r
20//You can specify your function here:\r
21function func($x) {\r
22\r
23$offset = 20; //1.1 //1 //0 -> Zero offset will draw only half of sin curve.\r
24$width = 1; //20 //35 //40 //This will stretch every line.\r
25\r
26$y = ( ( (3 / $x) + $offset) * $width );\r
27//echo("Debug: ".$x." ".$y." "); //Debug\r
28return ($y);\r
29\r
30}\r
31\r
32//Code:\r
33echo ("[SinusCurve]-[c][Harvie][2oo6]\n\n");\r
34echo (" | y\n");\r
35echo ("-|--------------------------------------------->\n");\r
36echo ("x|\n");\r
37echo (" V\n\n");\r
38\r
39sleep(2);\r
40\r
41//Set x to $start:\r
42$pos = $start;\r
43\r
44//Drawing:\r
45while(1) {\r
46\r
47 //usleep($sleep); //Wait in microseconds\r
48 \r
49 $znaku = func($pos);\r
50 \r
51 $zoom2 = $zoom;\r
52 while ($zoom2 > 0) {\r
53 \r
54 $znaku2 = round($znaku); //It looks better after round ;)\r
55 while ($znaku2 > 0) {\r
56 echo $line;\r
57 $znaku2 = ($znaku2 - 1);\r
58 }\r
59 //echo(" ".$pos); //Debug\r
60 echo ($endline);\r
61 \r
62 $zoom2 = ($zoom2 - 1);\r
63 }\r
64 \r
65 //Draw: Y axis:\r
66 //echo(" ".$pos."\n"); //Debug\r
67 if ($pos == $zero) {\r
68 echo("-+------------------------------------------------------------>\n");\r
69 }\r
70 \r
71 //Increase X:\r
72 $pos = ($pos + $step);\r
73 \r
74 //Reset (for neverending curves, etc...):\r
75 if ( ($pos >= $reset) && ($reset != "") ) {\r
76 $pos = $resetto;\r
77 }\r
78 \r
79 //Stop if $stop is reached:\r
80 if ($pos > $stop) {\r
81 die();\r
82 }\r
83\r
84}\r
85?>\r
This page took 0.385384 seconds and 4 git commands to generate.