Add 2011/borsanyi/try.sh + format/typo checks

Format/typo check README.md.

The try.sh script is as usual to show the entry a bit.

Also updated bugs status with INABIAF section.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-25 12:08:29 -08:00
1 parent b18d0c5fa8
commit 08ce66e590
5 files changed
+81 -7

No files matched your search

+16 -5
View File
@@ -4,6 +4,16 @@
make
```
### Bugs and (Mis)features:
The current status of this entry is:
```
STATUS: INABIAF - please **DO NOT** fix
```
For more detailed information see [2011 borsanyi in bugs.md](/bugs.md#2011-borsanyi).
## To use:
@@ -15,9 +25,7 @@ make
### Try:
```sh
./borsanyi < data.1
./borsanyi < data.2
./borsanyi < data.3
./try.sh
```
@@ -27,7 +35,8 @@ This is a nice quick [histogram](https://en.wikipedia.org/wiki/Histogram)
plotter. A useful utility when you need to look at the distribution of some
data.
Here are some challenges:
### Challenges:
You can modify the number of histogram
[bins](https://en.wikipedia.org/wiki/Data_binning) and the scaling of the
@@ -38,7 +47,7 @@ histogram bins is missing. The source contains no arrays and it does not
use `malloc(3)` or `alloca(3)`. How does it build the histogram?
While the input does not need to be sorted, the histogram output is sorted.
How does it put the data into buckets? Why does it `fork()` 22 times?
How does it put the data into buckets? Why does it `fork(2)` 22 times?
## Author's remarks:
@@ -49,6 +58,7 @@ histogram. I am all too often logged in to a remote machine with
slow X connection, and a terminal-based program would be of
great help.
### Limitations
* I optimized the output for the data I had around, you might want to adjust
@@ -62,6 +72,7 @@ great help.
* Could rounding errors cause the omission of the highest bin? There might be
empty bins at the edges.
### Obfuscation
* The program follows a rather unconventional approach to the task
+2 -2
View File
@@ -8,5 +8,5 @@ t )/22,s= pow(10, (int)( log10(a)) /*It is
a simple tool to quickly analyze data. */
- 2),s=t- (a =s*( int)(a/s ))/2,p(t, s,(int)(
( a+M-t)/ a)):p(t >M|x<t?x :t,t>M|x >M?x:M ,--n)+(x
> s&&x <= s+a); } main(j){ j==1?j=p (1,0,0) ,printf(
"%+12g %4d",s+a/2,j,wait(NULL)),main(j*400/n):putchar(35-25*!j)&' '&&main(j+1);}
> s&&x <= s+a); } main(j,k)char**k;{ j==1?j=p (1,0,0) ,printf(
"%+12g %4d",s+a/2,j,wait(NULL)),main(j*400/n,k):putchar(35-25*!j)&' '&&main(j+1,k);}
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2011/borsanyi
#
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
read -r -n 1 -p "Press any key to run: ./borsanyi < data.1: "
./borsanyi < data.1
echo 1>&2
read -r -n 1 -p "Press any key to run: ./borsanyi < data.2: "
./borsanyi < data.2
echo 1>&2
read -r -n 1 -p "Press any key to run: ./borsanyi < data.3: "
./borsanyi < data.3
+26
View File
@@ -2435,6 +2435,31 @@ There was no IOCCC in 2010.
# 2011
## 2011 dlowe
### STATUS: INABIAF - please **DO NOT** fix
### Source code: [2011/borsanyi/borsanyi.c](2011/borsanyi/borsanyi.c)
### Information: [2011/borsanyi/README.md](2011/borsanyi/README.md)
For a great amount of data points the program will crash, depending on your
available stack space.
Giving too few (distinct) points can also cause a crash or division by zero.
The program expects plain numbers separated by whitespace.
This program assumes ASCII.
If you give the program any arg it might flood the screen.
It requires both syscalls `fork(2)` and `wait(2)`.
Giving any arg to the program is likely to flood your screen.
Rounding errors might cause an omission in the highest bin. There might be empty
bins at the edges.
## 2011 dlowe
### STATUS: missing or dead link - please provide them
@@ -2462,6 +2487,7 @@ tends to result in empty output.
If you want to try and fix this (mis)feature, you are welcome to try.
## 2011 richards
### STATUS: doesn't work with some platforms - please help us fix
+9
View File
@@ -3215,6 +3215,15 @@ have been a problem in linux with the old `int`s but this is no longer known.
# <a name="2011"></a>2011
## [2011/borsanyi](2011/borsanyi/borsanyi.c) ([README.md](2011/borsanyi/README.md]))
Cody, out of an abundance of caution, added a second arg to `main()` as some
versions of clang complain about not only the type of each arg to `main()` but
the number of args as well.
Cody also added the [try.sh](2011/borsanyi/try.sh) script.
## [2011/goren](2011/goren/goren.c) ([README.md](2011/goren/README.md]))
Cody fixed this for macOS. Before the fix it segfaulted. It worked fine under