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