Another stupid coding trick



  • I had way too much time on my hands tonight and so I created a batch file that generates a mandelbrot set.

     It's not perfect because of the lack of floating point, but still...

    code:

    @echo off
    echo mandelbrot batch file by Jonathan Schwartz
    SETLOCAL ENABLEDELAYEDEXPANSION
    SETLOCAL ENABLEEXTENSIONS 
    set MaxX=80
    set MaxY=49
    

    set /a Im = -3000
    rem for each line of image
    for /L %%G in (1, 1, %MaxY%) do (
    set /a Re = -6000
    set thing=
    rem for each pixel in the line
    for /L %%H in (1, 1, %MaxX%) do (
    set /a Zr = !Re!
    set /a Zi = !Im!
    set /a n = 39
    rem 20 iterations
    rem for /L %%I in (1, 1, 20) do (call :thirdloop)
    call :thirdloop
    if !n! == 59 (set /a n = 95)
    call :getcharfrominteger n
    rem echo !n!
    rem echo re!Re!
    set /a Re = !Re! + 9000 / %MaxX%

    	rem echo !Re!
    )
    echo !thing!
    rem echo im!Im!
    set /a Im = !Im! + 6000 / %MaxY%
    

    )
    goto :EOF

    :thirdloop
    rem loop up to 20 times
    set /a index = 0
    :thirdloopbody
    	if !index! GEQ 20 goto :EOF
    	set /a index = !index! + 1
    	set /a a = ^(!Zr! * !Zr!^)/3000
        set /a b = ^(!Zi! * !Zi!^)/3000
    	set /a temp = !a! + !b!
    	rem echo a and b !temp!
    	rem if !temp! LSS 0 set thing=%thing%err
        if !temp! GEQ 12000 goto :EOF
        set /a Zi = ^(!Zr! * !Zi!^)/3000
        set /a Zr = !a! - !b! + !Re!
        set /a Zi = !Zi! + !Zi! + !Im!
        set /a n = !n! + 1
    goto thirdloopbody
    

    rem gets chars in range 39-59 + 95
    rem puts character back into passed in variable
    :getcharfrominteger
    set /a charcode = %1
    if !charcode! EQU 95 goto getcharfromintegerjumparea
    if !charcode! GEQ 39 (
    if !charcode! LEQ 59 goto getcharfromintegerjumparea
    )
    set %1 = ""
    goto :EOF
    :getcharfromintegerjumparea
    goto code!charcode!
    :code39
    set thing=%thing%^'
    goto :EOF
    :code40
    set thing=%thing%^(
    goto :EOF
    :code41
    set thing=%thing%^)
    goto :EOF
    :code42
    set thing=%thing%*
    goto :EOF
    :code43
    set thing=%thing%^+
    goto :EOF
    :code44
    set thing=%thing%^,
    goto :EOF
    :code45
    set thing=%thing%-
    goto :EOF
    :code46
    set thing=%thing%.
    goto :EOF
    :code47
    set thing=%thing%/
    goto :EOF
    :code48
    set thing=%thing%0
    goto :EOF
    :code49
    set thing=%thing%1
    goto :EOF
    :code50
    set thing=%thing%2
    goto :EOF
    :code51
    set thing=%thing%3
    goto :EOF
    :code52
    set thing=%thing%4
    goto :EOF
    :code53
    set thing=%thing%5
    goto :EOF
    :code54
    set thing=%thing%6
    goto :EOF
    :code55
    set thing=%thing%7
    goto :EOF
    :code56
    set thing=%thing%8
    goto :EOF
    :code57
    set thing=%thing%9
    goto :EOF
    :code58
    set thing=%thing%:
    goto :EOF
    :code59
    set thing=%thing%^;
    goto :EOF
    :code95
    set thing=%thing%_
    goto :EOF

    sample output:

    ''''''''(((((())))))))))))))))))))))********+++,-/8/1_,+******)))))(((((((((((((
    '''''''(((((()))))))))))))))))))))*********++++,-/2_1.,++******))))))(((((((((((
    ''''''(((((()))))))))))))))))))))*********++++,-.0491.-,++******))))))((((((((((
    ''''''(((())))))))))))))))))))))*********++++,.:04__9/.,+++*****)))))))(((((((((
    '''''(((()))))))))))))))))))))**********+++,,-:_8____33-,++++****)))))))((((((((
    '''''((()))))))))))))))))))))*********+++,,,-.04______2.-,++++****)))))))(((((((
    ''''(((())))))))))))))))))))*********++,,,,--.0________.-,,,++++***)))))))((((((
    ''''((()))))))))))))))))))*********++,------./0_______1/.-,,,,,,+**))))))))(((((
    ''''(()))))))))))))))))))*******++++,_121//__235_____63604/----0.+**)))))))(((((
    '''(()))))))))))))))))))******+++++,-0__6318____________7__////5.,+*))))))))((((
    '''(()))))))))))))))))*****++++++,,,-/3___8_______________923__83-+**))))))))(((
    '''()))))))))))))))))***++++++++,,,-./__________________________0,++*))))))))(((
    ''(()))))))))))))))***+++++++++,,,,./039________________________.,++**))))))))((
    ''())))))))))))))***++++++++++,,,-.7_8________________________50-,,+**))))))))((
    ''()))))))))))****+/-,,,,,,,,,,---.2____________________________.-,+**)))))))))(
    ''))))))))******++,._.----6.-----./38___________________________304+***))))))))(
    '())))))******+++,,080//.04//..../3______________________________:6+***))))))))(
    '())))*******++++,,.0486215_2_0//02______________________________1-+***)))))))))
    ')))********+++++,--/1________81116______________________________/-+****))))))))
    '))********+++++,--.03__________33_______________________________:-+****))))))))
    ')********+++++,--.037__________:6______________________________7/,+****))))))))
    '********++++,,.6//15____________________________________________.,+****))))))))
    '*******+,,,,--.2383:___________________________________________3,++****))))))))
    '++++,.-,,,---./2_______________________________________________-,++****))))))))
    '++,,-01.._//043______________________________________________3.-,++****))))))))
    ',---.30//5001:5______________________________________________1.-,++****))))))))
    '+++,,.--,,---//3______________________________________________2-,++****))))))))
    '******+,,,,,--/2665:___________________________________________0,++****))))))))
    '********+++,,-.3//15____________________________________________-,+****))))))))
    ')********+++++,-..05____________7_______________________________/,+****))))))))
    '))********+++++,--.03__________34________________________________-+****))))))))
    ')))********+++++,--/2_________2127______________________________0-+****))))))))
    '()))********++++,,.03_6226_350//04_____________________________80-+***)))))))))
    '()))))*******+++,,/_0/0/040/..../2_______________________________1+***)))))))))
    '())))))))******++,._.---.5.----..0______________________________1_+***))))))))(
    ''())))))))))****+,/.,,,,,,,,,---..1____________________________/.,+***))))))))(
    ''()))))))))))))***+,,+++++++,,,,-.___________________________50.-,+**))))))))((
    ''())))))))))))))))**++++++++++,,,-.114_________________________-,++**))))))))((
    '''())))))))))))))))****++++++++,,,-./4________________________5/,++*))))))))(((
    '''(()))))))))))))))))****+++++++,,,-/4____________________38___3-+**))))))))(((
    '''(()))))))))))))))))))*****+++++,,-1__8928____________9_4/0104/,+*))))))))((((
    ''''(()))))))))))))))))))*******+++,-3291//49356_____74_161.--.1.+**))))))))((((
    ''''((()))))))))))))))))))********+++--..--.//15______1/..-,,,,.+**))))))))(((((
    ''''((())))))))))))))))))))*********++,,,,---.0_______3.--,,++++***)))))))((((((
    '''''((()))))))))))))))))))))*********++,,,,-.05______1.-,+++++***)))))))(((((((
    '''''(((()))))))))))))))))))))**********+++,,-_______44-,++++****)))))))((((((((
    ''''''(((()))))))))))))))))))))**********++++,.614__40/,+++******))))))(((((((((
    ''''''((((())))))))))))))))))))))*********++++,-.1472.-,++******))))))((((((((((
    '''''''(((((()))))))))))))))))))))*********+++,--/170.,++******))))))(((((((((((
    


  • The only thing that is even less useful than a Mandelbrot set visualizer is an ASCII Mandelbrot set visualizer implemented as a batch script.

    Out of interest, what do the numbers at the edge mean?



  • they're there to try to make the edge look like a mandelbrot edge. 



  • @derula said:

    The only thing that is even less useful than a Mandelbrot set visualizer is an ASCII Mandelbrot set visualizer implemented as a batch script.

    Out of interest, what do the numbers at the edge mean?

     

     

    umm... and what about making mandelbrot set visualizer (zoomable) on excel table, with vba?



  • @SEMI-HYBRID code said:

    @derula said:

    The only thing that is even less useful than a Mandelbrot set visualizer is an ASCII Mandelbrot set visualizer implemented as a batch script.

    Out of interest, what do the numbers at the edge mean?
     

     

    umm... and what about making mandelbrot set visualizer (zoomable) on excel table, with vba?

    that would be about the same level of usefulness



  • @DescentJS said:

    @SEMI-HYBRID code said:
    @derula said:
    The only thing that is even less useful than a Mandelbrot set visualizer is an ASCII Mandelbrot set visualizer implemented as a batch script.

    Out of interest, what do the numbers at the edge mean?

    umm... and what about making mandelbrot set visualizer (zoomable) on excel table, with vba?

    that would be about the same level of usefulness

    A bit more stupid though.



  • @derula said:

    @DescentJS said:
    @SEMI-HYBRID code said:
    @derula said:
    The only thing that is even less useful than a Mandelbrot set visualizer is an ASCII Mandelbrot set visualizer implemented as a batch script.

    Out of interest, what do the numbers at the edge mean?
    umm... and what about making mandelbrot set visualizer (zoomable) on excel table, with vba?
    that would be about the same level of usefulness
    A bit more stupid though.
     

    Except 500% awesome.



  • Ha ha... this is awesome. 

    Lucky for you. My "stupid coding trick" was moved to the Funny Stuff forum almost immediately after I posted it. At least here on the side bar it'll get far more views. 



  • @dhromed said:

    @derula said:

    @DescentJS said:
    @SEMI-HYBRID code said:
    @derula said:
    The only thing that is even less useful than a Mandelbrot set visualizer is an ASCII Mandelbrot set visualizer implemented as a batch script.

    Out of interest, what do the numbers at the edge mean?
    umm... and what about making mandelbrot set visualizer (zoomable) on excel table, with vba?
    that would be about the same level of usefulness
    A bit more stupid though.
     

    Except 500% awesome.

     that's exactly what i meant...

     




  • @SEMI-HYBRID code said:

    @dhromed said:

    @derula said:

    @DescentJS said:
    @SEMI-HYBRID code said:
    @derula said:
    The only thing that is even less useful than a Mandelbrot set visualizer is an ASCII Mandelbrot set visualizer implemented as a batch script.

    Out of interest, what do the numbers at the edge mean?
    umm... and what about making mandelbrot set visualizer (zoomable) on excel table, with vba?
    that would be about the same level of usefulness
    A bit more stupid though.
     

    Except 500% awesome.

     that's exactly what i meant...

     

     

    i'd already try to do it, exept that i have OpenOffice, so no VBA for me :-(

    never thought i would miss it...



  •  @SEMI-HYBRID code said:

    @SEMI-HYBRID code said:

    @dhromed said:

    @derula said:

    @DescentJS said:
    @SEMI-HYBRID code said:
    @derula said:
    The only thing that is even less useful than a Mandelbrot set visualizer is an ASCII Mandelbrot set visualizer implemented as a batch script.

    Out of interest, what do the numbers at the edge mean?
    umm... and what about making mandelbrot set visualizer (zoomable) on excel table, with vba?
    that would be about the same level of usefulness
    A bit more stupid though.
     

    Except 500% awesome.

     that's exactly what i meant...

     

     

    i'd already try to do it, exept that i have OpenOffice, so no VBA for me :-(

    never thought i would miss it...

    That must have been legendary.



  • @Monkios said:

    À cause de la Chartre de la Langue Française, toutes mes réponses doivent se faire en français.
     

    You mean charte, not Chartre.



  • @nixar said:

    @Monkios said:

    À cause de la Chartre de la Langue Française, toutes mes réponses doivent se faire en français.
     

    You mean charte, not Chartre.

    I know you're somewhat new to posting here, but rezzing a 2 week-old thread to post something like this is gay.



  • @morbiuswilters said:

    I know you're somewhat new to posting here, but rezzing a 2 week-old thread to post something like this is gay.

    Well what I had to say was important enough to excuse this breach of ana...err étiquette. Wasn't it?



  • @nixar said:

    @morbiuswilters said:

    I know you're somewhat new to posting here, but rezzing a 2 week-old thread to post something like this is gay.

    Well what I had to say was important enough to excuse this breach of ana...err étiquette. Wasn't it?

    No, it was retarded.  You could have sent a PM.



  • @nixar said:

    @morbiuswilters said:

    I know you're somewhat new to posting here, but rezzing a 2 week-old thread to post something like this is gay.

    Well what I had to say was important enough to excuse this breach of ana...err étiquette. Wasn't it?

     

    Nope, in particular since chartre is a) also correct, even though obsolete and b) has other meanings which make it funnier.


Log in to reply