Part 0: preparation |
Part 1: Mandelbrot function |
Part 2: Gray-scale image |
a.out < mand4.txt
Print out their values using printf() to make sure you did this properly.
(-1.25, 0.75) (-0.75, 0.75) (-0.25, 0.75) ( 0.25, 0.75) (-1.25, 0.25) (-0.75, 0.25) (-0.25, 0.25) ( 0.25, 0.25) (-1.25, -0.25) (-0.75, -0.25) (-0.25, -0.25) ( 0.25, -0.25) (-1.25, -0.75) (-0.75, -0.75) (-0.25, -0.75) ( 0.25, -0.75)
(-1.25, 0.75): 2 (-0.75, 0.75): 3 (-0.25, 0.75): 21 ( 0.25, 0.75): 4 (-1.25, 0.25): 8 (-0.75, 0.25): 12 (-0.25, 0.25): 255 ( 0.25, 0.25): 255 (-1.25, -0.25): 8 (-0.75, -0.25): 12 (-0.25, -0.25): 255 ( 0.25, -0.25): 255 (-1.25, -0.75): 2 (-0.75, -0.75): 3 (-0.25, -0.75): 21 ( 0.25, -0.75): 4
Again, check that your code works properly with other data files.( 64.0, 448.0): 2 (192.0, 448.0): 3 (320.0, 448.0): 21 (448.0, 448.0): 4 ( 64.0, 320.0): 8 (192.0, 320.0): 12 (320.0, 320.0): 255 (448.0, 320.0): 255 ( 64.0, 192.0): 8 (192.0, 192.0): 12 (320.0, 192.0): 255 (448.0, 192.0): 255 ( 64.0, 64.0): 2 (192.0, 64.0): 3 (320.0, 64.0): 21 (448.0, 64.0): 4
n
. Also, convert
the iteration count t into a gray-scale value using the
formula 1.0 - t/255.0. You are now ready to produce the
turtle graphics output.
C 0.992 0.992 0.992 F 64.000 64.000 S 128.000 C 0.969 0.969 0.969 F 64.000 192.000 S 128.000 C 0.969 0.969 0.969 F 64.000 320.000 S 128.000 C 0.992 0.992 0.992 F 64.000 448.000 S 128.000 C 0.988 0.988 0.988 F 192.000 64.000 S 128.000 C 0.953 0.953 0.953 F 192.000 192.000 S 128.000 C 0.953 0.953 0.953 F 192.000 320.000 S 128.000 C 0.988 0.988 0.988 F 192.000 448.000 S 128.000 C 0.918 0.918 0.918 F 320.000 64.000 S 128.000 C 0.000 0.000 0.000 F 320.000 192.000 S 128.000 C 0.000 0.000 0.000 F 320.000 320.000 S 128.000 C 0.918 0.918 0.918 F 320.000 448.000 S 128.000 C 0.984 0.984 0.984 F 448.000 64.000 S 128.000 C 0.000 0.000 0.000 F 448.000 192.000 S 128.000 C 0.000 0.000 0.000 F 448.000 320.000 S 128.000 C 0.984 0.984 0.984 F 448.000 448.000 S 128.000
Part 3: Color image |
In this part, you will create a glorious color image of the Mandelbrot set.
cp mandgray.c mandcolor.c
C 0.000 0.734 0.000 F 64.000 64.000 S 128.000 C 0.750 0.859 0.750 F 64.000 192.000 S 128.000 C 0.750 0.859 0.750 F 64.000 320.000 S 128.000 C 0.000 0.734 0.000 F 64.000 448.000 S 128.000 C 0.734 0.734 0.000 F 192.000 64.000 S 128.000 C 0.500 0.500 0.000 F 192.000 192.000 S 128.000 C 0.500 0.500 0.000 F 192.000 320.000 S 128.000 C 0.734 0.734 0.000 F 192.000 448.000 S 128.000 C 0.859 0.359 0.234 F 320.000 64.000 S 128.000 C 0.000 0.000 0.000 F 320.000 192.000 S 128.000 C 0.000 0.000 0.000 F 320.000 320.000 S 128.000 C 0.859 0.359 0.234 F 320.000 448.000 S 128.000 C 0.734 0.000 0.000 F 448.000 64.000 S 128.000 C 0.000 0.000 0.000 F 448.000 192.000 S 128.000 C 0.000 0.000 0.000 F 448.000 320.000 S 128.000 C 0.734 0.000 0.000 F 448.000 448.000 S 128.000