/* ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» º º º º º cmandel = ADVANCED PROGRAM TO MAP THE MANDELBROT SET º º º ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ */ #include #include #include #include #include "tools.h" const int maxcol = 639; const int maxrow = 349; const int max_colors = 16; int CURSOR_X=0,CURSOR_Y=0,col,row; int max_iterations = 512; int max_size = 4; int LINEWIDTH=1, OPERATOR=0x00, ANGLE, XCENTER, YCENTER; unsigned long int PATTERN=0xFFFFFFFF; unsigned char PALETTE[16]={0,1,2,3,4,5,20,7,56,57,58,59,60,61,62,63}; int colors[16]={0,1,2,3,4,5,20,7,56,57,58,59,60,61,62,63}; double Q[350]; float TXMax,TXMin,TYMax,TYMin; union LIMIT XMax,YMax,XMin,YMin,Pval,Qval; char file_name[13] = {"mandel00.pcx"}; main() { double P,deltaP, deltaQ, X, Y, Xsquare, Ysquare; int i,color, row, col,error,response,repeat=0x30,start_col; printf("\nEnter background and 15 other colors separated by" " commas: "); scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &colors[0],&colors[1],&colors[2], &colors[3], &colors[4],&colors[5],&colors[6],&colors[7], &colors[8],&colors[9],&colors[10], &colors[11], &colors[12],&colors[13],&colors[14],&colors[15]); printf("Enter screen number (00 - 99): "); file_name[6] = getche(); file_name[7] = getche(); getch(); error = restore_screen(file_name); for (i=0; i<16; i++) setEGApalette(i,colors[i]); if (error == 0) { printf("\nEnter 0 to generate first Mandelbrot screen"); printf("\nEnter 1 to exit: "); response = getche(); if (response != 0x30) exit(0); else { XMax.f = 1.2; XMin.f = -2.0; YMax.f = 1.2; YMin.f = -1.2; start_col = 0; setMode(16); cls(7); } } else { if (error < 639) { start_col = 8 * (error/8); remove(file_name); } else { start_col = 0; move_cursor(0,15,0,0); move_cursor(1,15,CURSOR_X,CURSOR_Y); cls(7); XMax.f = TXMax; XMin.f = TXMin; YMax.f = TYMax; YMin.f = TYMin; } } while (repeat == 0x30) { deltaP = (XMax.f - XMin.f)/(maxcol); deltaQ = (YMax.f - YMin.f)/(maxrow); Q[0] = YMax.f; for (row=1; row<=maxrow; row++) Q[row] = Q[row-1] - deltaQ; P = XMin.f + start_col * deltaP; for (col=start_col; col