Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Ken Perlins strange code

  1. #1
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404

    Ken Perlins strange code

    I could never get this to compile properly before, but did so tonight.
    I got the code from here and made a codeblocks project for it in c. I did compile it to an executable too, so you can download and run it to see what it outputs without installing a c compiler or the codeblocks ide. Top of the page you see a message compile this:

    http://cs.nyu.edu/~perlin/

    Please run the exe file from a command window. I didn't want to alter the code, so if you run it from windows it runs and the command windows goes away quickly.

    I decided to attach a screenshot if you don't want to download to see what it outputs.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by kryton9; 12-06-2011 at 08:00.

  2. #2
    thinBasic MVPs danbaron's Avatar
    Join Date
    Jan 2010
    Location
    California
    Posts
    1,378
    Rep Power
    152
    Mandelbrot Set:

    "You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields

  3. #3
    thanks for this, also he has many toys, i like the butterfly
    http://mrl.nyu.edu/~perlin/experiments/butterfly/

  4. #4
    This is my interpretation in OxygenBasic

    sys x,y,k, single i,j,r, string b
    for y=0 to 31
      for x=1 to 84
        b+=mid " .:-;!/>)|&IH%*#",1+(k and 15),1
        i=0 : k=0 : r=0
        do
          j=r*r-i*i-2+x*.04 : i=2*r*i-1.6+y*.1 : r=j
          if k++>110 or i*i+j*j>10 then exit do
        end do
      next
      b+=chr(13)+chr(10)
    next
    putfile "m.txt",b
    
    Charles

  5. #5
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404
    He does have a wonder of stuff there on his site.

    Charles also has another version which can be scaled and customized character set that is fun to play with.
    http://www.oxygenbasic.org/forum/ind...icseen#msg1261

  6. #6
    Here is the ScriptBasic version.

    for y=0 to 31
      for x=1 to 84
        b&=mid(" .:-;!/>)|&IH%*#",1+(k and 15),1)
        i=0
        k=0
        r=0
        repeat
          j=r*r-i*i-2+x*.04
          i=2*r*i-1.6+y*.1
          r=j
          k+=1
        until k>110 or i*i+j*j>10
      next
      b&="\n"
    next
    print b
    
     :::::::::::::::::::::--------------------------------::::::::::::::::::::::::::::::
    ::::::::::::::::--------------------------------------------::::::::::::::::::::::::
    :::::::::::------------------------------------------------------:::::::::::::::::::
    ::::::::----------------------------------;;;;;;;-------------------::::::::::::::::
    :::::-----------------------------;;;;;;;;;;;;;;;;;;;;;;---------------:::::::::::::
    :::--------------------------;;;;;;;;;;;;!!!/-%//!!!;;;;;;;;-------------:::::::::::
    :------------------------;;;;;;;;;;;;;!!!!//>)I#&IH/!!!;;;;;;;-------------:::::::::
    :---------------------;;;;;;;;;;;;;!!!!!//>>|&:# &)>/!!!!!;;;;;;-------------:::::::
    :-----------------;;;;;;;;;;;;!!!!!!////>>)&-####/-&>>//!!!!!;;;;;-------------:::::
    :--------------;;;;;;;;;;!!!!!!!//>))H))|&&H #####%I||)>>>>#/!!;;;;-------------::::
    :---------;;;;;;;;;;!!!!!!!!!////>)%-## &#############.H%I#H >!!;;;;-------------:::
    :-----;;;;;;;;;!!!!!//////////>>)&:%-##################### H)//!!;;;;-------------::
    :--;;;;;;;;;!!!!/>&&)>>>))>>>))|&%.########################*&I>!!;;;;;-------------:
    :;;;;;;;;!!!!!//>>|I.-!H#;% I&&I>############################|>/!!;;;;;------------:
    :;;;;;!!!!!///>>)|H%-;########  ############################ I//!!;;;;;-------------
    :!!!!/////>>>)|%*:##########################################|>/!!!;;;;;-------------
    :########################################################.I|>//!!!;;;;;-------------
    :!!!!/////>>>)|%*:##########################################|>/!!!;;;;;-------------
    :;;;;;!!!!!///>>)|H%-;########  ############################ I//!!;;;;;-------------
    :;;;;;;;;!!!!!//>>|I.-!H#;% I&&I>############################|>/!!;;;;;------------:
    :--;;;;;;;;;!!!!/>&&)>>>))>>>))|&%.########################*&I>!!;;;;;-------------:
    :-----;;;;;;;;;!!!!!//////////>>)&:%-##################### H)//!!;;;;-------------::
    :---------;;;;;;;;;;!!!!!!!!!////>)%-## &#############.H%I#H >!!;;;;-------------:::
    :--------------;;;;;;;;;;!!!!!!!//>))H))|&&H #####%I||)>>>>#/!!;;;;-------------::::
    :-----------------;;;;;;;;;;;;!!!!!!////>>)&-####/-&>>//!!!!!;;;;;-------------:::::
    :---------------------;;;;;;;;;;;;;!!!!!//>>|&:# &)>/!!!!!;;;;;;-------------:::::::
    :------------------------;;;;;;;;;;;;;!!!!//>)I#&IH/!!!;;;;;;;-------------:::::::::
    :::--------------------------;;;;;;;;;;;;!!!/-%//!!!;;;;;;;;-------------:::::::::::
    :::::-----------------------------;;;;;;;;;;;;;;;;;;;;;;---------------:::::::::::::
    ::::::::----------------------------------;;;;;;;-------------------::::::::::::::::
    :::::::::::------------------------------------------------------:::::::::::::::::::
    ::::::::::::::::--------------------------------------------::::::::::::::::::::::::
    
    Last edited by John Spikowski; 14-06-2011 at 04:54.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  7. #7
    Member
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    406
    Rep Power
    56
    Hi John,

    Your ScriptBasic version looks very cool !
    Is fine structured.

    I like also 'REPEAT / UNTIL' command .

  8. #8
    Thanks for the reply.

    It doesn't take long to get spoiled with ScriptBasic's type-less variable design.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  9. #9
    Quote Originally Posted by Charles Pegge View Post
    This is my interpretation in OxygenBasic

    sys x,y,k, single i,j,r, string b
    for y=0 to 31
      for x=1 to 84
        b+=mid " .:-;!/>)|&IH%*#",1+(k and 15),1
        i=0 : k=0 : r=0
        do
          j=r*r-i*i-2+x*.04 : i=2*r*i-1.6+y*.1 : r=j
          if k++>110 or i*i+j*j>10 then exit do
        end do
      next
      b+=chr(13)+chr(10)
    next
    putfile "m.txt",b
    
    Charles
    Charles,

    I tried the above code (which I based the SB version on) and your output is different.

     :::::::::::::::::::::--------------------------------:::::::::::::::::::::::::::::: 
    ::::::::::::::::--------------------------------------------:::::::::::::::::::::::: 
    :::::::::::------------------------------------------------------::::::::::::::::::: 
    ::::::::----------------------------------;;;;;;;-------------------:::::::::::::::: 
    :::::-----------------------------;;;;;;;;;;;;;;;;;;;;;;---------------::::::::::::: 
    :::--------------------------;;;;;;;;;;;;!!!/-%//!!!;;;;;;;;-------------::::::::::: 
    :------------------------;;;;;;;;;;;;;!!!!//>)I#&I /!!!;;;;;;;--------------:::::::: 
    :---------------------;;;;;;;;;;;;;!!!!!//>>|&:# &)>/!!!!!;;;;;;-------------::::::: 
    :-----------------;;;;;;;;;;;;!!!!!!////>>)&-    /-&>>//!!!!!;;;;;-------------::::: 
    :--------------;;;;;;;;;;!!!!!!!//>))H))|&&H      %I||)>>>>#/!!;;;;-------------:::: 
    :---------;;;;;;;;;;!!!!!!!!!////>)%-   &             .H%I#H >!!;;;;-------------::: 
    :-----;;;;;;;;;!!!!!//////////>>)&:%-                      H)//!!;;;;-------------:: 
    :--;;;;;;;;;!!!!/>&&)>>>))>>>))|&%.                        *&I>!!;;;;;-------------: 
    :;;;;;;;;!!!!!//>>|I. !H#;% I&&I>                           #|>/!!;;;;;------------: 
    :;;;;;!!!!!///>>)|H%-;                                       I//!!;;;;;------------- 
    :!!!!/////>>>)|%*:##           #                            |>/!!!;;;;;------------- 
    :#I. I )*%) # .                                          .I|>//!!!;;;;;------------- 
    :!!!!/////>>>)|%*:##           #                            |>/!!!;;;;;------------- 
    :;;;;;!!!!!///>>)|H%-;                                       I//!!;;;;;------------- 
    :;;;;;;;;!!!!!//>>|I..!H#;% I&&I>                           #|>/!!;;;;;------------: 
    :--;;;;;;;;;!!!!/>&&)>>>))>>>))|&%.                        *&I>!!;;;;;-------------: 
    :-----;;;;;;;;;!!!!!//////////>>)&:%-                      H)//!!;;;;-------------:: 
    :---------;;;;;;;;;;!!!!!!!!!////>)%-   &             .H%I#H >!!;;;;-------------::: 
    :--------------;;;;;;;;;;!!!!!!!//>))H))|&&H      %I||)>>>>#/!!;;;;-------------:::: 
    :-----------------;;;;;;;;;;;;!!!!!!////>>)&-    /-&>>//!!!!!;;;;;-------------::::: 
    :---------------------;;;;;;;;;;;;;!!!!!//>>|&:# &)>/!!!!!;;;;;;-------------::::::: 
    :------------------------;;;;;;;;;;;;;!!!!//>)I#&I)/!!!;;;;;;;--------------:::::::: 
    :::--------------------------;;;;;;;;;;;;!!!/-%//!!!;;;;;;;;-------------::::::::::: 
    :::::-----------------------------;;;;;;;;;;;;;;;;;;;;;;---------------::::::::::::: 
    ::::::::----------------------------------;;;;;;;-------------------:::::::::::::::: 
    :::::::::::------------------------------------------------------::::::::::::::::::: 
    ::::::::::::::::--------------------------------------------::::::::::::::::::::::::
    
    This is the original compiled with gcc under Ubuntu 64.

    main(k){float i,j,r,x,y=-16;while(puts(""),y++<15)for(x
    =0;x++<84;putchar(" .:-;!/>)|&IH%*#"[k&15]))for(i=k=r=0;
    j=r*r-i*i-2+x/25,i=2*r*i+y/10,j*j+i*i<11&&k++<111;r=j);}
    
    .............::::::::::::::::::::::::::::::::::::::::::::::::.......................
    .........::::::::::::::::::::::::::::::::::::::::::::::::::::::::...................
    .....::::::::::::::::::::::::::::::::::-----------:::::::::::::::::::...............
    ...:::::::::::::::::::::::::::::------------------------:::::::::::::::.............
    :::::::::::::::::::::::::::-------------;;;!:H!!;;;--------:::::::::::::::..........
    ::::::::::::::::::::::::-------------;;;;!!/>&*|I !;;;--------::::::::::::::........
    ::::::::::::::::::::-------------;;;;;;!!/>)|.*#|>/!!;;;;-------::::::::::::::......
    ::::::::::::::::-------------;;;;;;!!!!//>|:    !:|//!!!;;;;-----::::::::::::::.....
    ::::::::::::------------;;;;;;;!!/>)I>>)||I#     H&))>////*!;;-----:::::::::::::....
    ::::::::----------;;;;;;;;;;!!!//)H:  #|              IH&*I#/;;-----:::::::::::::...
    :::::---------;;;;!!!!!!!!!!!//>|.H:                     #I>/!;;-----:::::::::::::..
    :----------;;;;!/||>//>>>>//>>)|%                         %|&/!;;----::::::::::::::.
    --------;;;;;!!//)& |;I*-H#&||&/                           *)/!;;-----::::::::::::::
    -----;;;;;!!!//>)IH:-        ##                            #&!!;;-----::::::::::::::
    ;;;;!!!!!///>)H%.**           *                            )/!;;;------:::::::::::::
                                                             &)/!!;;;------:::::::::::::
    ;;;;!!!!!///>)H%.**           *                            )/!;;;------:::::::::::::
    -----;;;;;!!!//>)IH:-        ##                            #&!!;;-----::::::::::::::
    --------;;;;;!!//)& |;I*-H#&||&/                           *)/!;;-----::::::::::::::
    :----------;;;;!/||>//>>>>//>>)|%                         %|&/!;;----::::::::::::::.
    :::::---------;;;;!!!!!!!!!!!//>|.H:                     #I>/!;;-----:::::::::::::..
    ::::::::----------;;;;;;;;;;!!!//)H:  #|              IH&*I#/;;-----:::::::::::::...
    ::::::::::::------------;;;;;;;!!/>)I>>)||I#     H&))>////*!;;-----:::::::::::::....
    ::::::::::::::::-------------;;;;;;!!!!//>|:    !:|//!!!;;;;-----::::::::::::::.....
    ::::::::::::::::::::-------------;;;;;;!!/>)|.*#|>/!!;;;;-------::::::::::::::......
    ::::::::::::::::::::::::-------------;;;;!!/>&*|I !;;;--------::::::::::::::........
    :::::::::::::::::::::::::::-------------;;;!:H!!;;;--------:::::::::::::::..........
    ...:::::::::::::::::::::::::::::------------------------:::::::::::::::.............
    .....::::::::::::::::::::::::::::::::::-----------:::::::::::::::::::...............
    .........::::::::::::::::::::::::::::::::::::::::::::::::::::::::...................
    .............::::::::::::::::::::::::::::::::::::::::::::::::.......................
    
    Here is Matthew's Basic4GL version running under Wine.

    Last edited by John Spikowski; 15-06-2011 at 00:12.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  10. #10
    It looks like the image from the GCC version contains a little more detail than the OxygenBasic version. It could be a difference caused by the datatypes being used to store variables or maybe you're using the 64-bit version of GCC?

    If anyone's interested I knocked together a version in Basic4GL, it's here on my wiki.

Page 1 of 2 12 LastLast

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •