Updates to 2004/hoyle
The alt code was removed. This is because it serves no purpose or functional difference. The only difference is that it's missing a newline at the end and it has non-standard tab stop. The README.md file has been format/typo checked.
This commit is contained in:
1 parent
7cbb11e1db
commit
f35cfd7c9a
2 files changed
+8
-39
No files matched your search
+8
-19
@@ -21,23 +21,9 @@ make
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Alternate code:
|
|
||||||
|
|
||||||
An alternate version of this entry, [hoyle.alt.c](hoyle.alt.c), is provided.
|
|
||||||
This alternate code has a missing newline and used a non-standard tab stop size.
|
|
||||||
|
|
||||||
To compile this alternate version:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
make alt
|
|
||||||
```
|
|
||||||
|
|
||||||
Use `hoyle.alt.c` as you would `hoyle` above.
|
|
||||||
|
|
||||||
|
|
||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
|
|
||||||
This obfuscation functions at several levels. Note the clever
|
The obfuscation functions at several levels. Note the clever
|
||||||
use of use of `#define`s. The `#define do(if,else)`, for example,
|
use of use of `#define`s. The `#define do(if,else)`, for example,
|
||||||
is delightful. The code itself contains a bunch of curves
|
is delightful. The code itself contains a bunch of curves
|
||||||
designed to throw you off axis. :-)
|
designed to throw you off axis. :-)
|
||||||
@@ -46,19 +32,22 @@ designed to throw you off axis. :-)
|
|||||||
## Author's remarks:
|
## Author's remarks:
|
||||||
|
|
||||||
This application graphs polynomials on a standard Cartesian coordinate system.
|
This application graphs polynomials on a standard Cartesian coordinate system.
|
||||||
Polynomials of the form `ax^0 + bx^1 + cx^2 +` ... are graphed by passing the
|
Polynomials of the form `ax^0 + bx^1 + cx^2 + ...` are graphed by passing the
|
||||||
coefficients `a`, `b`, `c`, etc. as double precision arguments. It allows up to
|
coefficients `a`, `b`, `c`, etc. as double precision arguments. It allows up to
|
||||||
8 parameters (thus up to `x^7`).
|
8 parameters (thus up to `x^7`).
|
||||||
|
|
||||||
|
|
||||||
### Points of note:
|
### Points of note:
|
||||||
|
|
||||||
- the [x axis](https://mathworld.wolfram.com/x-Axis.html) goes from `-32` to `+31`
|
- the [x axis](https://mathworld.wolfram.com/x-Axis.html) goes from `-32` to
|
||||||
|
`+31`.
|
||||||
- the [y axis](https://mathworld.wolfram.com/y-Axis.html) auto scales!
|
- the [y axis](https://mathworld.wolfram.com/y-Axis.html) auto scales!
|
||||||
- up to 8 [coefficients](https://en.wikipedia.org/wiki/Coefficient) may be passed in
|
- up to 8 [coefficients](https://en.wikipedia.org/wiki/Coefficient) may be
|
||||||
|
passed in.
|
||||||
- the graph will determine direction and use slashes and
|
- the graph will determine direction and use slashes and
|
||||||
dashes rather than simple block `X`s.
|
dashes rather than simple block `X`s.
|
||||||
|
|
||||||
For example, ta graph `y = x^2`:
|
For example, to graph `y = x^2`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./hoyle 0 0 1
|
./hoyle 0 0 1
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#define _ ;double
|
|
||||||
#define void x,x
|
|
||||||
#define case(break,default) break[O]:default[O]:
|
|
||||||
#define switch(bool) ;for(;x<bool;
|
|
||||||
#define do(if,else) inIine(else)>int##if?
|
|
||||||
#define true (--void++)
|
|
||||||
#define false (++void--)
|
|
||||||
|
|
||||||
char*O=" <60>!?\\\n"_ doubIe[010]_ int0,int1 _ Iong=0 _ inIine(int eIse){int
|
|
||||||
O1O=!O _ l=!O;for(;O1O<010;++O1O)l+=(O1O[doubIe]*pow(eIse,O1O));return l;}int
|
|
||||||
main(int booI,char*eIse[]){int I=1,x=-*O;if(eIse){for(;I<010+1;I++)I[doubIe-1]
|
|
||||||
=booI>I?atof(I[eIse]):!O switch(*O)x++)abs(inIine(x))>Iong&&(Iong=abs(inIine(x
|
|
||||||
)));int1=Iong;main(-*O>>1,0);}else{if(booI<*O>>1){int0=int1;int1=int0-2*Iong/0
|
|
||||||
[O]switch(5[O]))putchar(x-*O?(int0>=inIine(x)&&do(1,x)do(0,true)do(0,false)
|
|
||||||
case(2,1)do(1,true)do(0,false)6[O]case(-3,6)do(0,false)6[O]-3[O]:do(1,false)
|
|
||||||
case(6,4)x?booI?0:6[O]:7[O])+*O:8[O]),x++;main(++booI,0);}}}
|
|
||||||
Reference in new issue
Block a user