Fix 1988/litmaath/README.md + add alt code
There was no 'To build' or 'To run' section. The alt code is that which the judges suggested to try and understand the code a bit more. As it was fun output and it seems instructive I decided to add it as an alt version. Updated .gitignore.
This commit is contained in:
1 parent
864cc7bffb
commit
ac949a735d
4 files changed
+47
-6
No files matched your search
@@ -1 +1,2 @@
|
|||||||
litmaath
|
litmaath
|
||||||
|
litmaath.alt
|
||||||
@@ -111,8 +111,8 @@ OBJ= ${PROG}.o
|
|||||||
DATA=
|
DATA=
|
||||||
TARGET= ${PROG}
|
TARGET= ${PROG}
|
||||||
#
|
#
|
||||||
ALT_OBJ=
|
ALT_OBJ= ${PROG}.alt.o
|
||||||
ALT_TARGET=
|
ALT_TARGET= ${PROG}.alt
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
|
|||||||
+28
-4
@@ -1,18 +1,42 @@
|
|||||||
# Best small program
|
# Best small program
|
||||||
|
|
||||||
Maarten Litmaath
|
Maarten Litmaath
|
||||||
Free University (VU) Amsterdam
|
|
||||||
Department of computer science
|
|
||||||
Uilenstede 72
|
|
||||||
1183 AK Amstelveen
|
|
||||||
The Netherlands
|
The Netherlands
|
||||||
|
|
||||||
|
## To build:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
## To run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./litmaath some text
|
||||||
|
```
|
||||||
|
|
||||||
|
There is an alternate version provided. See the Alternate code section below.
|
||||||
|
|
||||||
## Try:
|
## Try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./litmaath eschew obfuscation
|
./litmaath eschew obfuscation
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Alternate code:
|
||||||
|
|
||||||
|
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) added the
|
||||||
|
[litmaath.alt.c](litmaath.alt.c) which we described in our remarks below. To
|
||||||
|
use:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make alt
|
||||||
|
```
|
||||||
|
|
||||||
|
Use `litmaath.alt` as you would `litmaath` above.
|
||||||
|
|
||||||
|
Thank you Cody!
|
||||||
|
|
||||||
|
|
||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
{
|
||||||
|
while (*argv != argv[1] && (*argv = argv[1]) && (argc = 0) || (*++argv
|
||||||
|
&& (**argv && ((++argc)[*argv] && (**argv <= argc[*argv] ||
|
||||||
|
(**argv += argc[*argv] -= **argv = argc[*argv] - **argv)) &&
|
||||||
|
--argv || putchar(**argv) && ++*argv--) || putchar(10))))
|
||||||
|
fprintf(stderr,
|
||||||
|
"argv=%lo *argv=%lo **argv=%c argv[1]=%lo *argv[1]=%c argc=%d\n",
|
||||||
|
(long) argv, (long) *argv, *argv && **argv ? **argv : '@',
|
||||||
|
(long) argv[1], argv[1] && *argv[1] ? *argv[1] : '@', argc);
|
||||||
|
|
||||||
|
;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user