F### yeh! i still got it baby!

lukeh put out an elegant F# mandelbrot program, that gives this output to the console:

                                        #

####
####
# ##########
#################
###################
#####################
####### ######################
######### ######################
#############################################
######### ######################
####### ######################
#####################
###################
#################
# ##########
####
####

#

i tinkered with it, just to see if i could understand how it was working...

I turned the output into this:

000000000000001111111111111111111111111111111111111111111111111111
000000000000111111111111111111111111111111111111111111111111111111
000000000011111111111111122222222222111111111111111111111111111111
000000001111111111222222222222222222222222211111111111111111111111
000000011111112222222222222222333334974433322221111111111111111111
000000111112222222222222222333333445698994333322221111111111111111
000001112222222222222222333333344457899975443333222221111111111111
000011222222222222222233333334455679 97544443322222211111111111
000112222222222222233333344567777899 99875559433222221111111111
001122222222222223333444455699 99 99999943222222111111111
001222222222223344444445557999 9654322222211111111
0122222223334469666666666799 9894332222221111111
022233333344456999999998899 975332222222111111
02333333444456799 99 964333222222111111
0333335555679999 9 754333222222111111
0 97654333222222111111
0333335555679999 9 754333222222111111
02333333444456799 99 964333222222111111
022233333344456999999998899 975332222222111111
0122222223334469666666666799 9894332222221111111
001222222222223344444445557999 9654322222211111111
001122222222222223333444455699 99 99999943222222111111111
000112222222222222233333344567777899 99875559433222221111111111
000011222222222222222233333334455679 97544443322222211111111111
000001112222222222222222333333344457899975443333222221111111111111
000000111112222222222222222333333445698994333322221111111111111111
000000011111112222222222222222333334974433322221111111111111111111
000000001111111111222222222222222222222222211111111111111111111111
000000000011111111111111122222222222111111111111111111111111111111
000000000000111111111111111111111111111111111111111111111111111111
000000000000001111111111111111111111111111111111111111111111111111
000000000000000011111111111111111111111111111111111111111111111100

I think i'm getting the hang of it!

I love learning by doing... you change a little bit and then you run it again... then you tweak something else and you see what happens...

Here's my minor variation on luke's code Only difference:

i noticed he was saying "a * a" in one place, which is very cumbersome and repetitive [ ;-) ] -- so i implemented a custom 'squared' operator in there, using this name for the operator: '!!!!!@**'

Now instead of getting sore wrists typing out something as long winded and error prone as "a * a", i could simply say ( !!!!!@** a ) and F# would treat this as a * a.

Also, i reversed the 'colours', showing how many iterations it takes the function to 'escape' the inner circle from a given point. (i did know some maths stuff once upon a time y'know).

(I wrote a 'min' function in there too. i know there'd be one implemented already, but i'm trying to do simple tinkering here ;-) )

Your mission!

Next step: do the same thing rendering pixels to a bitmap instead... then i could try breaking that up amongst multiple cores... no... sleep time.

The interested reader is invited to finish this problem for me ;-)

Also -- here it is side on!

00000000000000000000000000000000000000000000000000000000
00000000000000111222223334943332222211100000000000000000
00000000011112222222333336963333322222221111000000000000
00000111112222222223333356965333332222222221111100000000
00011111222222222223334456965443332222222222211111000000
11111112222222222233444567 76544433222222222221111111000
11111222222222222344445999 99954444322222222222211111110
1111222222222222346666799   9976666432222222222221111111
11122222222222234568999       99986543222222222222111111
1122222222222334446799         9976444332222222222211111
112222222222333444699           996444333222222222211111
1222222222333344456799         9976544433332222222221111
12222222333334455667899       99876655443333322222221111
2222222333334555799 9           9 9975554333332222222111
222223333334699999                 999996433333322222111
22223333344579                         97544333332222111
222233344456799                       997654443332222111
2223344459789                           9879544433222111
1223976789   9                         9   9876793221111
122345899    9                         9    998543221111
11233496799999                         99999769433211111
11223334445689                         98654443332211111
111223333445579                       975544333322111111
111122233344579  9        9        9  975443332221111111
1111122223334698668 9999766679999 8668964333222211111111
11111112222233344444544444444444544444333222221111111111
11111111222222222333333333333333333322222222211111111111
11111111112222222222222222222222222222222221111111111111
11111111111112222222222222222222222222221111111111111111
11111111111111111222222222222222222211111111111111111111
 

My book "Choose Your First Product" is available now.

It gives you 4 easy steps to find and validate a humble product idea.

Learn more.

(By the way, I read every comment and often respond.)

Your comment, please?

Your Name
Your Url (optional)
Note: I may edit, reuse or delete your comment. Don't be mean.