/* this program constantly generates 9 random points, and makes a bézier interpolation over those points, and making a landscape following the interpolation :) it also draws the lines connecting the 9 random points, so you can see how the interpolation is done (notice it'll touch the first and last line in the beginning and ending point, that's one of the properties of a bézier interpolation) basically i put all the coordinates in an integer array , fill the screen with green, and then draw vertical lines from the top until the interpolated value in black, so i get the green landscape with as shape the interpolated bézier curve over the 9 randomly generated points :) this is a first attempt, so it's a bit messy, also i'm new to fenix, so i've probably done some things pretty inefficient :) */ program terra; const width=320;//constant containing the width of the screen. global terra[width];//this integer array will hold the interpolated values points[9];//this integer array will hold the randomly generated points. begin SET_MODE(320,240,8); loop delete_draw(0);//i'll draw lines, so i need to remove them every time :) generateland();//i generate the 9 points and calculate the interpolation with this process :) fill(40);//i fill the screen with green (hey, that rhymes!) drawland(0);//and i draw the land (well the not land in fact, WHO CARES?) drawch();//and i draw the lines :) frame;//if i don't do this, nothing would show, you'd like that, don't you? end; end; /* method drawing the landscape, we have got the coordinates in terra[] (filled by generateland()) and we draw it in the given color :) */ process drawland(color) private i; begin for(i=0; i0)//as long as our number is higher than 0 (well, even 1 would be good, cause x*1 = 1 :D) r*=t--;//multiply the value we'll return by it, and decrease it's value end; return r;//return the found value end; /* method drawing the lines between the controlling points of which we make the bézier interpolation. */ process drawch(); private i; begin for(i=0;i<8;i++)//we'll have to draw 8 lines (between 9 points) DRAW_LINE(i*40,points[i],(i+1)*40,points[i+1]);//draw the line between the current and next point. end; end;