Skip to content

Instantly share code, notes, and snippets.

@Harvie
Last active December 31, 2015 20:49
Show Gist options
  • Save Harvie/8043147 to your computer and use it in GitHub Desktop.
Save Harvie/8043147 to your computer and use it in GitHub Desktop.

Revisions

  1. Harvie renamed this gist Dec 19, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. Harvie created this gist Dec 19, 2013.
    73 changes: 73 additions & 0 deletions hodiny
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,73 @@
    <?php


    function polarx($u,$v){
    return ($v*cos(deg2rad($u)));
    }
    function polary($u,$v){
    return ($v*sin(deg2rad($u)));
    }
    $x=23;
    $y=23;
    //tady sestavujeme ciferník
    $cif=array();
    for($i=0;$i<$x;$i=$i+1) {
    for($j=0;$j<$y;$j=$j+1) {
    if (false){
    $cif[$j][$i]="*";
    } else {
    $cif[$j][$i]=" ";
    }

    }
    }

    $cif[$y/2][$x/2]=".";
    for($h=0;$h<12;$h=$h+3){
    $uhel=-($h*(360/12));
    $px=round (polarx($uhel,10))+$x/2;
    $py=round(polary($uhel,10))+$y/2;
    $cif[$py][$px]="$h";

    }

    //tady vykreslujeme ciferník
    for($i=0;$i<$x;$i=$i+1) {
    for($j=0;$j<$y;$j=$j+1) {
    if (($i==$y-$j-1) || ($i==3)){
    echo($cif[$j][$i]);
    } else {
    echo($cif[$j][$i]);
    }

    }
    echo("\n");
    }

    /* Vystup:



    6









    3 . 9









    0

    */