diff options
author | epochqwert <epoch@hacking.allowed.org> | 2015-04-24 03:56:26 -0500 |
---|---|---|
committer | epochqwert <epoch@hacking.allowed.org> | 2015-04-24 03:56:26 -0500 |
commit | 89b165504c98599839dfb8a8988f27e91db2dba2 (patch) | |
tree | 4a8d5c1e7939040f42910aa472eae6b20a351dda /src/bin/dragonturn.c | |
parent | a36652959e52e8c810b7d2d76a283b2ae9718d96 (diff) | |
download | misc-89b165504c98599839dfb8a8988f27e91db2dba2.tar.gz misc-89b165504c98599839dfb8a8988f27e91db2dba2.zip |
added three little programs for generating dragon curve ascii-art.
lineplot and turn2line can be used for other stuff, but some constants will need to be changed. also they were golfed. so have fun.
Diffstat (limited to 'src/bin/dragonturn.c')
-rw-r--r-- | src/bin/dragonturn.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/bin/dragonturn.c b/src/bin/dragonturn.c new file mode 100644 index 0000000..a12bb97 --- /dev/null +++ b/src/bin/dragonturn.c @@ -0,0 +1,14 @@ +#include <stdio.h> +#include <string.h> +int main(int argc,char *argv[]) { + int i,j; + char turns[1024]="R",append[1024],tmp[1024]; + for(i=0;i<atoi(argv[1]);i++) { + strcpy(append,turns); + strcat(turns,"R"); + for(j=0;append[j];j++) tmp[strlen(append)-j-1]=append[j]=='R'?'L':'R'; + tmp[j]=0; + strcat(turns,tmp); + } + printf("F%s\n",turns); +} |