Skip to main content
Commonmark migration
Source Link

#PHP, 184 bytes

PHP, 184 bytes

for($r=" ";++$i;sleep(print chunk_split(str_pad($r,96,"
",0),12)),$r=$k="0")for(;$c="ABCDEFGHIJKWco{zyxwvutsrqpdXL@"[$k];)$r[ord($c)-64]="Happy Birthday Raffaele Cecco "[($i+$k++)%30];

prints 39 newlines to clear the screen; run with -nr.
The actual pause is 1 second; but I sped up the gif.

HappyBirthday

ungolfed

$p = "ABCDEFGHIJKWco{zyxwvutsrqpdXL@";  # (positions for characters)+64 to ASCII
$t = "Happy Birthday Raffaele Cecco ";  # string to rotate
for($r=" ";                     # init result to string
    ++$i;                       # infinite loop
    $r=$k="0")                      # 6. reset $r and $k
{
    for(;$c=$p[$k];)                # 1. loop through positions
        $r[ord($c)-64]=                 # set position in result
        $t[($i+$k++)%30];               # to character in string
    sleep(                          # 5. wait 1 second
        print                       # 4. print
            chunk_split(
            str_pad($r,96,"\n",0)   # 2. pad to 96 chars (prepend 36 newlines)
            ,12)                    # 3. insert newline every 12 characters
        );
}

#PHP, 184 bytes

for($r=" ";++$i;sleep(print chunk_split(str_pad($r,96,"
",0),12)),$r=$k="0")for(;$c="ABCDEFGHIJKWco{zyxwvutsrqpdXL@"[$k];)$r[ord($c)-64]="Happy Birthday Raffaele Cecco "[($i+$k++)%30];

prints 39 newlines to clear the screen; run with -nr.
The actual pause is 1 second; but I sped up the gif.

HappyBirthday

ungolfed

$p = "ABCDEFGHIJKWco{zyxwvutsrqpdXL@";  # (positions for characters)+64 to ASCII
$t = "Happy Birthday Raffaele Cecco ";  # string to rotate
for($r=" ";                     # init result to string
    ++$i;                       # infinite loop
    $r=$k="0")                      # 6. reset $r and $k
{
    for(;$c=$p[$k];)                # 1. loop through positions
        $r[ord($c)-64]=                 # set position in result
        $t[($i+$k++)%30];               # to character in string
    sleep(                          # 5. wait 1 second
        print                       # 4. print
            chunk_split(
            str_pad($r,96,"\n",0)   # 2. pad to 96 chars (prepend 36 newlines)
            ,12)                    # 3. insert newline every 12 characters
        );
}

PHP, 184 bytes

for($r=" ";++$i;sleep(print chunk_split(str_pad($r,96,"
",0),12)),$r=$k="0")for(;$c="ABCDEFGHIJKWco{zyxwvutsrqpdXL@"[$k];)$r[ord($c)-64]="Happy Birthday Raffaele Cecco "[($i+$k++)%30];

prints 39 newlines to clear the screen; run with -nr.
The actual pause is 1 second; but I sped up the gif.

HappyBirthday

ungolfed

$p = "ABCDEFGHIJKWco{zyxwvutsrqpdXL@";  # (positions for characters)+64 to ASCII
$t = "Happy Birthday Raffaele Cecco ";  # string to rotate
for($r=" ";                     # init result to string
    ++$i;                       # infinite loop
    $r=$k="0")                      # 6. reset $r and $k
{
    for(;$c=$p[$k];)                # 1. loop through positions
        $r[ord($c)-64]=                 # set position in result
        $t[($i+$k++)%30];               # to character in string
    sleep(                          # 5. wait 1 second
        print                       # 4. print
            chunk_split(
            str_pad($r,96,"\n",0)   # 2. pad to 96 chars (prepend 36 newlines)
            ,12)                    # 3. insert newline every 12 characters
        );
}
pause=1 sec
Source Link
Titus
  • 14.8k
  • 1
  • 24
  • 41

#PHP, 177184 bytes

for($r=" ";++$i;print";++$i;sleep(print chunk_split(str_pad($r,96,"\n""
",0),12)),$r=$k="0")for(;$c="ABCDEFGHIJKWco{zyxwvutsrqpdXL@"[$k];)$r[ord($c)-64]="Happy Birthday Raffaele Cecco "[($i+$k++)%30];

prints 39 newlines to clear the screen; run with -nr.
The actual pause is 1 second; but I sped up the gif.

HappyBirthday

ungolfed

$p = "ABCDEFGHIJKWco{zyxwvutsrqpdXL@";  # (positions for characters)+64 to ASCII
$t = "Happy Birthday Raffaele Cecco ";  # string to rotate
for($r=" ";                     # init result to string
    ++$i;                       # infinite loop
    $r="0"$r=$k="0")                      # 56. reset $r and $k
{
    for($k=0;$c=$p[$k];;$c=$p[$k];)                # 1. loop through positions
        $r[ord($c)-64]=                 # set position in result
        $t[($i+$k++)%30];               # to character in string
    sleep(                          # 5. wait 1 second
        print                       # 4. print
            chunk_split(
            str_pad($r,96,"\n",0)   # 2. pad to 96 chars (prepend 36 newlines)
            ,12)                    # 3. insert newline every 12 characters
        );
}

#PHP, 177 bytes

for($r=" ";++$i;print chunk_split(str_pad($r,96,"\n",0),12),$r=$k="0")for(;$c="ABCDEFGHIJKWco{zyxwvutsrqpdXL@"[$k];)$r[ord($c)-64]="Happy Birthday Raffaele Cecco "[($i+$k++)%30];

prints 39 newlines to clear the screen; run with -nr.

HappyBirthday

ungolfed

$p = "ABCDEFGHIJKWco{zyxwvutsrqpdXL@";  # (positions for characters)+64 to ASCII
$t = "Happy Birthday Raffaele Cecco ";  # string to rotate
for($r=" ";                 # init result to string
    ++$i;                   # infinite loop
    $r="0")                     # 5. reset $r
{
    for($k=0;$c=$p[$k];)        # 1. loop through positions
        $r[ord($c)-64]=             # set position in result
        $t[($i+$k++)%30];           # to character in string
    print                       # 4. print
        chunk_split(
        str_pad($r,96,"\n",0)   # 2. pad to 96 chars (prepend 36 newlines)
        ,12)                    # 3. insert newline every 12 characters
    );
}

#PHP, 184 bytes

for($r=" ";++$i;sleep(print chunk_split(str_pad($r,96,"
",0),12)),$r=$k="0")for(;$c="ABCDEFGHIJKWco{zyxwvutsrqpdXL@"[$k];)$r[ord($c)-64]="Happy Birthday Raffaele Cecco "[($i+$k++)%30];

prints 39 newlines to clear the screen; run with -nr.
The actual pause is 1 second; but I sped up the gif.

HappyBirthday

ungolfed

$p = "ABCDEFGHIJKWco{zyxwvutsrqpdXL@";  # (positions for characters)+64 to ASCII
$t = "Happy Birthday Raffaele Cecco ";  # string to rotate
for($r=" ";                     # init result to string
    ++$i;                       # infinite loop
    $r=$k="0")                      # 6. reset $r and $k
{
    for(;$c=$p[$k];)                # 1. loop through positions
        $r[ord($c)-64]=                 # set position in result
        $t[($i+$k++)%30];               # to character in string
    sleep(                          # 5. wait 1 second
        print                       # 4. print
            chunk_split(
            str_pad($r,96,"\n",0)   # 2. pad to 96 chars (prepend 36 newlines)
            ,12)                    # 3. insert newline every 12 characters
        );
}
Source Link
Titus
  • 14.8k
  • 1
  • 24
  • 41

#PHP, 177 bytes

for($r=" ";++$i;print chunk_split(str_pad($r,96,"\n",0),12),$r=$k="0")for(;$c="ABCDEFGHIJKWco{zyxwvutsrqpdXL@"[$k];)$r[ord($c)-64]="Happy Birthday Raffaele Cecco "[($i+$k++)%30];

prints 39 newlines to clear the screen; run with -nr.

HappyBirthday

ungolfed

$p = "ABCDEFGHIJKWco{zyxwvutsrqpdXL@";  # (positions for characters)+64 to ASCII
$t = "Happy Birthday Raffaele Cecco ";  # string to rotate
for($r=" ";                 # init result to string
    ++$i;                   # infinite loop
    $r="0")                     # 5. reset $r
{
    for($k=0;$c=$p[$k];)        # 1. loop through positions
        $r[ord($c)-64]=             # set position in result
        $t[($i+$k++)%30];           # to character in string
    print                       # 4. print
        chunk_split(
        str_pad($r,96,"\n",0)   # 2. pad to 96 chars (prepend 36 newlines)
        ,12)                    # 3. insert newline every 12 characters
    );
}