#include #include #define WIDTH 500 // width of picture - in pixels #define HEIGHT 300 //#define EYES 180 // eye seperation (assuming a 72 dpi screen) #define EYES 108 int randomBlackWhite() { return random(2) * EGA_WHITE; } void draw3D (int (*z)(int,int)) { int x, y, same[WIDTH], color[WIDTH], sep, i, j, s; for(y=0;yj) {same[i] = j;i=j;j=s;} else i = s; same[i] = j; } } for (x=WIDTH-1;x>=0;x--) { if (same[x]==x) color[x] = randomBlackWhite(); else color[x] = color[same[x]]; putpixel(x,y,color[x]); } } } #define GROUND (EYES/2) // a dot seperation for distanat object #define HAT (GROUND-1) // objects near background are easier to see int topHat(int x, int y) { int brimRadius = 70, headRadius = 30, brimHeight = 25; if (y>=HEIGHT/2-brimRadius) { if ((y= WIDTH/2-headRadius) && (x=WIDTH/2-brimRadius)&&(x