Dragon curve/C: Difference between revisions

m
Fixed syntax highlighting.
(Move long example to subpage)
 
m (Fixed syntax highlighting.)
 
(One intermediate revision by one other user not shown)
Line 1:
It uses an [[wp:L-system|L-system]] in order to generate the curve, the code from [[Raster graphics operations]] ("<tt>imglib.h</tt>") to produce the output in PPM format, and the code from [[Basic string manipulation functions]] (<tt>estrings.h</tt>) to manipulate strings keeping the ''evolution'' of the system.
 
<langsyntaxhighlight lang="c">#include <stdio.h>
#include <string.h>
#include "imglib.h"
Line 100:
}
}
}
}</lang>
 
<lang c>int main()
{
image out;
Line 123:
destroyString(seed);
return 0;
}</langsyntaxhighlight>
 
'''Note''': the color feature does not color "layers" of the run (like Algol); it just adds colors to the segments cyclically, making "noise" rather than delightful make up.
9,486

edits