diff --git a/2014/deak/README.md b/2014/deak/README.md index 47735f8df..1461e5ad6 100644 --- a/2014/deak/README.md +++ b/2014/deak/README.md @@ -5,7 +5,9 @@ make ``` There is an alternate version that the author provided but fixed in 2023 to -compile. See [alternate code](#alternate-code) below. +compile with modern systems and to allow one to reconfigure the constants `X1`, +`X2`, `Y1` and `Y2` (which were magic numbers). See [Alternate +code](#alternate-code) below. ## To use: @@ -29,16 +31,30 @@ various regions of the fractal. The alternate code is included as [prog.alt.c](prog.alt.c) so you can more easily see the difference in what it might look like if the C was more -recognisable. To use, try: +recognisable and also to let you reconfigure the coordinates. + + +### Alternate build: ```sh make alt ``` -Use `prog.alt` as you would `prog`. +If you wish to redefine the coordinates you can do so by defining `X1`, `X2`, +`Y1` and/or `Y2`, which default to: `-2`, `1`, `-1.3` and `1.3` respectively. +For instance: -Bonus: the author explains how to configure the program but can you figure out -how to do it in the alternate code? + +```sh +make clobber CDEFINE="-DX1=-3 -DX2=2 -DY1=-2.3 -DY2=2.3" alt +``` + +You may pick and choose which ones to redefine. + + +### Alternate use: + +Use `prog.alt` as you would `prog`. ## Judges' remarks: @@ -51,19 +67,21 @@ We liked the use of unary notation facilitated by variadic macros. ## Author's remarks: + ### Portability The application was written on a standard Ubuntu 14.04 and tested with -gcc 4.9.1 and clang 3.5 on 64 bit system (though this should not matter). +gcc 4.9.1 and clang 3.5 on a 64 bit system (though this should not matter). The application makes no assumption regarding any system specific settings, and it only needs a console to run. The provided Makefile is just to have an easy compilation. I don't see any problems porting it to different compiler/system as long as it supports the C99 standard. + ### The application The purpose of the application is mainly to illustrate the weird possibilities -of the C preprocessor, than to be a full featured console mode Mandelbrot +of the C preprocessor, rather than to be a full featured console mode Mandelbrot drawer. There are tools much better suited for drawing fractals. The usage of recognizable elements from the C programming language in the @@ -98,6 +116,7 @@ is to modify the source code at the indicated location: the line that the adventurous programmer can manually modify the coordinates of the fractal to be drawn on the screen. + ### Compiler warnings Yes, unfortunately there are compiler warnings of the kind "initialization makes diff --git a/2014/deak/prog.alt.c b/2014/deak/prog.alt.c index 2e7692977..cd110ebd4 100644 --- a/2014/deak/prog.alt.c +++ b/2014/deak/prog.alt.c @@ -1,6 +1,18 @@ #include -double _[]={-2 -,1,-1.3 ,1.3, 0, 0,0,0 +#ifndef X1 +#define X1 -2 +#endif +#ifndef X2 +#define X2 1 +#endif +#ifndef Y1 +#define Y1 -1.3 +#endif +#ifndef Y2 +#define Y2 1.3 +#endif +double _[]={X1 +,X2,Y1 ,Y2, 0, 0,0,0 ,0 ,0,50, 80, 0,0,0 ,255 , 8,0}; int main ( int j) {if (j== 1 ){ if( diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index b6165d3b9..797dece68 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -3670,17 +3670,20 @@ details). ## [2014/deak](2014/deak/prog.c) ([README.md](2014/deak/README.md)) -[Cody](#cody) fixed the code that the author provided which would be what the program -would look like if, as the author put it: +[Cody](#cody) added [alt code](2014/deak/README.md#alternate-code) that lets one +reconfigure the coordinates but instead of being a modified version of the entry +it is the version the author provided which would be what the program would look +like if, as the author put it: > The usage of recognizable elements from the C programming language in the -application source code is intentionally kept to a bare minimum. If this phrase -would not be true, the application would be the following: +application source code is intentionally kept to a bare minimum. -It did not compile because a value was left off the `return` statement. +.. was not true. -Cody added this as alternate code just for fun and so one can more easily see -the difference to really appreciate the obfuscation. +This alt version did not originally compile because a value was left off the +`return` statement (this might have been fixed in the README.md file too) so +that was fixed and it also has `#include ` for `putchar(3)`. The +`#ifndef..#define..#endif` was not part of the original alt code, of course. ## [2014/endoh1](2014/endoh1/prog.c) ([README.md](2014/endoh1/README.md]))