Update 2014/deak alt code + format/typo checks
The alt code now lets one redefine the coordinates (which was deliberately not obfuscated by the author for this purpose). A casual look at the code would make one think it's not an alt code but it's a fixed version that the author provided if a certain statement was not true (see README.md file) so the only thing that is different is that there is the #ifndef..#define..#endif of coordinates and the fix to compile (missing a return value, possibly also fixed in the README.md file, and an added #include <stdio.h> for putchar(3)).
This commit is contained in:
1 parent
ac132f8f6f
commit
4a946614e8
3 files changed
+50
-16
No files matched your search
+26
-7
@@ -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
|
||||
|
||||
+14
-2
@@ -1,6 +1,18 @@
|
||||
#include <stdio.h>
|
||||
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(
|
||||
|
||||
+10
-7
@@ -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 <stdio.h>` 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]))
|
||||
|
||||
Reference in new issue
Block a user