Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Sinusoidal japh

by imp (Priest)
on Aug 26, 2006 at 17:52 UTC ( #569822=obfuscated: print w/replies, xml ) Need Help??

My first obfu:
print join('',@$_),"\n" for map{@$_->[0]}map{[[map{ @$a=(@$a,1);int sin($_*0.1)*8==$b-8?[j,a,p,h] ->[$#$a%4]:' '}@$_],$b++]}([1..80])x16;
                                       hja          ja                          
                                      p               ph                        
                                    ja                  j                       
                                   h                     a                      
                                 ap                       ph                    
                                j                           j                   
j                             ph                             aph                
 a                          ja                                  j               
  p                        h                                     a              
   hj                     p                                       ph            
     a                  ja                                          j           
      ph              ph                                             ap         
        ja          ja                                                 hj       
          phjaphjaph                                                     aphjaph

Replies are listed 'Best First'.
Re: Sinusoidal japh
by liverpole (Monsignor) on Aug 27, 2006 at 19:07 UTC
    ++imp on a nice theme for a first Japh!

    A little formatting of the script, and your presentation could even hint at the output:

    print+ join $ x,@$_, $/for map{@ $_->[0 ]}map {[[map {push@ $a,1; int 8 *sin $_ *.1== $b-8? (j,a,p ,h)[@ $a%4] :$"}+ @$_], $b++] }([1.. 80])x16;

    By the way, it occurred to me that changing "==" to "<=" will integrate the sine wave:

    hjaphjaphj + japhjaphjaphjap + hjaphjaphjaphjaphj + aphjaphjaphjaphjaphja + japhjaphjaphjaphjaphjap + phjaphjaphjaphjaphjaphjaphj + aphjaphjaphjaphjaphjaphjaphja + a hjaphjaphjaphjaphjaphjaphjaphjaphj + ap aphjaphjaphjaphjaphjaphjaphjaphjaphja + aph japhjaphjaphjaphjaphjaphjaphjaphjaphjap + aphja hjaphjaphjaphjaphjaphjaphjaphjaphjaphjaphj + aphjap aphjaphjaphjaphjaphjaphjaphjaphjaphjaphjaphja + aphjaphj hjaphjaphjaphjaphjaphjaphjaphjaphjaphjaphjaphjap + aphjaphjap aphjaphjaphjaphjaphjaphjaphjaphjaphjaphjaphjaphjap + aphjaphjaphjaphjaphjaphjaphjaphjaphjaphjaphjaphjaphjaphjaphjaphjaphjap +

      Good idea on the formatting. It adds a lot to the presentation.

      Here's the beta version of the the fish variant:

      print join('', @$_) ,"\n" for map {@$_ -> [0] }map {[[map{@$a =( @$a,$c=abs int sin( $_* 0.1)* 6>=abs($b -6));$c?[J,A,P,H]-> [$#$a%4] :' '}@$_],$b++,]} ([1..44])x12;
Re: Sinusoidal japh - Fishy version
by imp (Priest) on Aug 27, 2006 at 15:05 UTC
    print join('',@$_),"\n" for map{@$_->[0]}map{[[map{@$a=(@$a ,1);abs int sin($_*0.1)*6==abs($b-6)?[j,a,p,h]->[$#$a%4]:' ' }@$_],$b++,]}([1..44])x12;
    I'll post a spoiler soon, ran out of time yesterday
Re: Sinusoidal japh - Spoiler
by imp (Priest) on Aug 27, 2006 at 17:48 UTC
    The basic strategy is to iterate over a 80x12 table of data, and for each item determine whether it appears on the sine wave, plotting the next letter in the repeating 'japh' sequence if so.

    The column index is treated as degree / 4.5, which yields 360 degrees for 80 columns.
    Radian = Column * 4.5 * pi / 180. The coordinate system is very coarse, so not much precision is needed. Reduced as follows:

    radian = column * 4.5 * 3.14 / 180
    radian = column * 0.0785
    radian = column * 0.1
    To golf a bit I keep track of the current column by pushing another value onto @$a in each column, and using $#$a for the current column index. Easier and more efficient to just use the value of $_... but it amused me.

    Using the sin * 6, and subtracting 6 from the current row ($b) is done to provide a +-6 vertical range for the sin wave.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://569822]
Approved by bobf
Front-paged by liverpole
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2018-04-21 06:06 GMT
Find Nodes?
    Voting Booth?