Merge pull request #1355 from xexyl/tvr1994
This commit is contained in:
5 files changed
+63
-15
No files matched your search
+1
-1
@@ -63,7 +63,7 @@ CDEFINE=
|
|||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
CINCLUDE= -I ${X11_INCDIR} -I ${X11_INCDIR}/X11
|
CINCLUDE= -I ${X11_INCDIR} -I ${X11_INCDIR}/X11 -include stdio.h
|
||||||
|
|
||||||
# Optimization
|
# Optimization
|
||||||
#
|
#
|
||||||
|
|||||||
+25
-14
@@ -4,6 +4,17 @@
|
|||||||
make all
|
make all
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Bugs and (Mis)features:
|
||||||
|
|
||||||
|
The current status of this entry is:
|
||||||
|
|
||||||
|
```
|
||||||
|
STATUS: known bug - please help us fix
|
||||||
|
STATUS: uses gets() - change to fgets() if possible
|
||||||
|
```
|
||||||
|
|
||||||
|
For more detailed information see [1994 tvr in bugs.md](/bugs.md#1994-tvr).
|
||||||
|
|
||||||
|
|
||||||
## To use:
|
## To use:
|
||||||
|
|
||||||
@@ -54,9 +65,11 @@ fix it without breaking something else?
|
|||||||
|
|
||||||
This program contains four pairs of fractals/effects and three methods of
|
This program contains four pairs of fractals/effects and three methods of
|
||||||
animating them. There are two windows for a pair of fractals, one of which
|
animating them. There are two windows for a pair of fractals, one of which
|
||||||
contains static fractal (e.g. Mandelbrot set) and the other an animating one
|
contains static fractal (e.g. [Mandelbrot
|
||||||
(e.g. Julian set) which is derived from the same formula as the static one. Only
|
set](https://en.wikipedia.org/wiki/Mandelbrot_set)) and the other an animating
|
||||||
one pair of fractals can be displayed in one process.
|
one (e.g. [Julia set](https://en.wikipedia.org/wiki/Julia_set)) which is derived
|
||||||
|
from the same formula as the static one. Only one pair of fractals can be
|
||||||
|
displayed in one process.
|
||||||
|
|
||||||
To animate the fractal, you must move your mouse on the static
|
To animate the fractal, you must move your mouse on the static
|
||||||
fractal window and the animated fractal will be calculated based
|
fractal window and the animated fractal will be calculated based
|
||||||
@@ -64,14 +77,13 @@ on mouse coordinates. If you are on one of the two non-stable
|
|||||||
modes (more about them later) you can stabilize the picture by
|
modes (more about them later) you can stabilize the picture by
|
||||||
pressing a mouse button. Pressing it does nothing on stable mode.
|
pressing a mouse button. Pressing it does nothing on stable mode.
|
||||||
|
|
||||||
|
|
||||||
The three modes are:
|
The three modes are:
|
||||||
|
|
||||||
- non-stable mode with simple 'attractor searcher'
|
- non-stable mode with simple 'attractor searcher'
|
||||||
- non-stable mode
|
- non-stable mode
|
||||||
- stable mode
|
- stable mode
|
||||||
|
|
||||||
On Mandelbrot/Julian mode the stable mode calculates normal Julian set according
|
On Mandelbrot/Julia mode the stable mode calculates normal Julia set according
|
||||||
to the Mandelbrot coordinates (mouse position). On non-stable modes the picture
|
to the Mandelbrot coordinates (mouse position). On non-stable modes the picture
|
||||||
slowly transforms to the same picture as on the stable mode but transformation
|
slowly transforms to the same picture as on the stable mode but transformation
|
||||||
can take some time. Usually, and especially if changes are relatively small
|
can take some time. Usually, and especially if changes are relatively small
|
||||||
@@ -83,13 +95,11 @@ when you first move your mouse to non-black areas of the Mandelbrot set, then
|
|||||||
back to near the center. In some cases 'attractor searcher' can be seen as
|
back to near the center. In some cases 'attractor searcher' can be seen as
|
||||||
noise.
|
noise.
|
||||||
|
|
||||||
|
The first of the fractal pairs is Mandelbrot/Julia set as mentioned before. The
|
||||||
The first of the fractal pairs is Mandelbrot/Julian set as mentioned before. The
|
second is a variation of that. The third makes nice 3D-look-a-like effects and
|
||||||
second is a variation of that. The third makes nice 3d-look-a-like effects and
|
|
||||||
the fourth is a variation of that with more nice effects.
|
the fourth is a variation of that with more nice effects.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Usage:
|
### Usage:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -103,8 +113,9 @@ actual `screenlength/width`. I.e. if you use 128 as a second parameter, you will
|
|||||||
get two 256x256 windows.
|
get two 256x256 windows.
|
||||||
|
|
||||||
The program needs reasonable values for both of these parameters to
|
The program needs reasonable values for both of these parameters to
|
||||||
operate. A good first try could be "0 128" or "8 128". The `colormap` has
|
operate. A good first try could be `0 128` or `8 128`. The `colormap` has
|
||||||
to be redirected into the programs standard input via the `colormapfile`.
|
to be redirected into the programs standard input via the `colormapfile`
|
||||||
|
parameter as shown above.
|
||||||
|
|
||||||
Note that you will need approximately `(second_parameter^2)*64` bytes of free
|
Note that you will need approximately `(second_parameter^2)*64` bytes of free
|
||||||
main memory or the machine will swap heavily (memory references are quite random
|
main memory or the machine will swap heavily (memory references are quite random
|
||||||
@@ -179,7 +190,7 @@ Mandelbrot set is calculated from the formula
|
|||||||
n+1 n 0
|
n+1 n 0
|
||||||
```
|
```
|
||||||
|
|
||||||
and the Julian set is calculated from the formula
|
and the Julia set is calculated from the formula
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -193,7 +204,7 @@ where `C` is the same throughout the picture. Both calculation are finished
|
|||||||
when `|Z| >= 2.0`. For the other fractals, the basic methods are the same but
|
when `|Z| >= 2.0`. For the other fractals, the basic methods are the same but
|
||||||
the formula is different (look at the source ;) )
|
the formula is different (look at the source ;) )
|
||||||
|
|
||||||
Note that Mandelbrot and Julian on this program aren't exactly correct. Find out
|
Note that Mandelbrot and Julia on this program aren't exactly correct. Find out
|
||||||
why ;)
|
why ;)
|
||||||
|
|
||||||
|
|
||||||
@@ -203,7 +214,7 @@ why ;)
|
|||||||
happen if a request of some of the resources fails e.g. getting colors.
|
happen if a request of some of the resources fails e.g. getting colors.
|
||||||
- No expose event handling.
|
- No expose event handling.
|
||||||
- It may be possible that the program starts drawing before window is mapped as
|
- It may be possible that the program starts drawing before window is mapped as
|
||||||
there is no XSync(). In that case drawn data is lost. Also, some window manager
|
there is no `XSync()`. In that case drawn data is lost. Also, some window manager
|
||||||
configurations places the second window on top of the first and again drawn
|
configurations places the second window on top of the first and again drawn
|
||||||
data will be lost. By default, windows are placed next to the other in the
|
data will be lost. By default, windows are placed next to the other in the
|
||||||
top left corner of the screen.
|
top left corner of the screen.
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
#define gets(B) fgets((B),C-(B)+256,stdin),(B[strlen(B)-1]='\0'),1
|
||||||
#define M typedef
|
#define M typedef
|
||||||
#define N( a)=r=(a)+j
|
#define N( a)=r=(a)+j
|
||||||
#define S f(; G; )D[B[R=i[--G]]=F+=F<p]++
|
#define S f(; G; )D[B[R=i[--G]]=F+=F<p]++
|
||||||
|
|||||||
@@ -1332,6 +1332,32 @@ if it checked for `!= EOF`.
|
|||||||
Since it works there is no need to fix this except for a challenge to yourself.
|
Since it works there is no need to fix this except for a challenge to yourself.
|
||||||
|
|
||||||
|
|
||||||
|
## 1994 tvr
|
||||||
|
|
||||||
|
### STATUS: known bug - please help us fix
|
||||||
|
### Source code: [1994/tvr/tvr.c](1994/tvr/tvr.c)
|
||||||
|
### Information: [1994/tvr/README.md](1994/tvr/README.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The judges said the following in their remarks:
|
||||||
|
|
||||||
|
```
|
||||||
|
The fractally minded may be able to detect that mode 0 does not calculate
|
||||||
|
Mandelbrot/Julian sets correctly. Can you find the bug? Better still, can you
|
||||||
|
fix it without breaking something else?
|
||||||
|
```
|
||||||
|
|
||||||
|
You are welcome to try and fix it and open a pull request, providing that it
|
||||||
|
doesn't break something else.
|
||||||
|
|
||||||
|
|
||||||
|
### STATUS: uses gets() - change to fgets() if possible
|
||||||
|
|
||||||
|
Although the entry itself was changed to use `fgets(3)` the alt code was not. It
|
||||||
|
would be better if both used `fgets(3)`.
|
||||||
|
|
||||||
|
|
||||||
# 1995
|
# 1995
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1823,6 +1823,16 @@ For an interesting problem that occurred here and what was done to solve it,
|
|||||||
check the [bugs.md](bugs.md) file.
|
check the [bugs.md](bugs.md) file.
|
||||||
|
|
||||||
|
|
||||||
|
## [1994/tvr](1994/tvr/tvr.c) ([README.md](1994/tvr/README.md]))
|
||||||
|
|
||||||
|
Cody made this use `fgets(3)` instead of `gets(3)`. In this case the newline had
|
||||||
|
to be terminated but it was a pretty straightforward fix. `gets()` was defined
|
||||||
|
to use `fgets()` and the inclusion of `stdio.h` had to be added but to make it
|
||||||
|
more like the original entry this was done in the Makefile.
|
||||||
|
|
||||||
|
Note that the alt code does not use `fgets(3)` but rather `gets(3)`.
|
||||||
|
|
||||||
|
|
||||||
## [1994/westley](1994/westley/westley.c) ([README.md](1994/westley/README.md]))
|
## [1994/westley](1994/westley/westley.c) ([README.md](1994/westley/README.md]))
|
||||||
|
|
||||||
Cody converted the spoiler compiler options (provided by the author) to be
|
Cody converted the spoiler compiler options (provided by the author) to be
|
||||||
|
|||||||
Reference in new issue
Block a user