Merge pull request #2025 from xexyl/westley94-alt

Add 1994/westley alt code (for easier use)
This commit is contained in:
Landon Curt Noll authored and GitHub committed 2024-01-23 12:08:45 -08:00
commit f1346e8b60
7 files changed
+254 -14

No files matched your search

+2
View File
@@ -1,9 +1,11 @@
#
# sort with: sort -d -u
a.out
*.dSYM
indent
indent.c
indent.o
prog.orig
westley
westley.alt
westley.orig
+6 -2
View File
@@ -111,8 +111,8 @@ OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
#
ALT_OBJ=
ALT_TARGET=
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt
#################
@@ -140,6 +140,10 @@ ${PROG}: ${PROG}.c
alt: data ${ALT_TARGET}
@${TRUE}
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
# data files
#
data: ${DATA}
+60 -10
View File
@@ -1,16 +1,16 @@
## To build:
```sh
make all
make alt
```
NOTE: the purpose of this entry is to escape the dungeon via the compiler line
where you **get messages as compiler errors**. Depending on the compiler line you
will get different error messages and one compiler line will make you win the
game!
NOTE: your terminal should be set to 80 columns, 8 character tabs, and
wraparound.
We recommend that you try the alternate version first as the original entry
requires (for good display) 80 columns and 8 character tabs with wraparound. The
alt code is the same as the original except that the original code used
`#include`s of files that do not exist to generate the messages (as compiler
errors) whereas the alt code uses `printf(3)`. The purpose of the game is to
escape the dungeon. For the original entry see [Original code](#original-code)
below.
## To use:
@@ -18,9 +18,53 @@ wraparound.
There is no running as such. See below.
## Try:
### Try:
But for something more interesting try compiling it with
For something more interesting try compiling it with
different cc arguments and then run the program each time. For example:
```sh
cc -Describe -Door westley.alt.c && ./a.out
cc -Describe -Drain westley.alt.c && ./a.out
```
To see the game from start to finish, try:
```sh
./try.alt.sh
```
## Original code:
NOTE: the purpose of this entry is to escape the dungeon via the compiler line
where you **get messages as compiler errors**. Depending on the compiler line you
will get different error messages and one compiler line will make you win the
game!
NOTE: your terminal should be set to 80 columns, 8 character tabs, and
wraparound. The alternate code does not have this limitation and it is for this
reason that we recommend you try it first.
### Original build:
```sh
make all
```
Depending on the compilation line you will get different messages (as errors)
which let you play the game.
## Original use:
There is no running as such. See below.
## Original try:
For something more interesting try compiling it with
different cc arguments. For example:
```sh
@@ -28,6 +72,12 @@ cc -Describe -Door westley.c
cc -Describe -Drain westley.c
```
To see the game from start to complete, try:
```sh
./try.sh
```
## Judges' remarks:
+63
View File
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
#
# try.alt.sh - demonstrate IOCCC winner 1994/westley alt code
#
# make sure CC is set so that one can control what compiler to use in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
rm -f a.out
"${CC}" -Describe -Door westley.alt.c && ./a.out
sleep 1
echo 1>&2
"${CC}" -Describe -Drain westley.alt.c && ./a.out
sleep 1
echo 1>&2
"${CC}" -Describe -Dwarf westley.alt.c && ./a.out
sleep 1
echo 1>&2
"${CC}" -Describe -Debris westley.alt.c && ./a.out # or -Dungeon
sleep 1
echo 1>&2
"${CC}" -Describe -Desk westley.alt.c && ./a.out
sleep 1
echo 1>&2
"${CC}" -Describe -Dime westley.alt.c && ./a.out
sleep 1
echo 1>&2
"${CC}" -Describe -Directory westley.alt.c && ./a.out
sleep 1
echo 1>&2
"${CC}" -Dial -DUNgeon0614 westley.alt.c && ./a.out
sleep 1
echo 1>&2
"${CC}" -Drink -Daiquiri westley.alt.c && ./a.out
sleep 1
echo 1>&2
"${CC}" -Drop -Daiquiri westley.alt.c && ./a.out
sleep 1
echo 1>&2
"${CC}" -Drop -Dwarf -Daiquiri westley.alt.c && ./a.out # or -Drop -Down -Daiquiri
sleep 1
echo 1>&2
"${CC}" -Describe -Document westley.alt.c && ./a.out
sleep 1
echo 1>&2
"${CC}" -Depress -Dotted -Dog westley.alt.c && ./a.out
sleep 1
echo 1>&2
"${CC}" -Depress -Dalmatian westley.alt.c && ./a.out # also accepts "Dalmation" [sic]
sleep 1
echo 1>&2
"${CC}" -Deposit -Dime westley.alt.c && ./a.out
sleep 1
echo 1>&2
"${CC}" -Drop -Donut westley.alt.c && ./a.out
sleep 1
echo 1>&2
"${CC}" -Drop -Donut -Down -Drain westley.alt.c && ./a.out # or -Drop -Dwarf -Donut
echo 1>&2
rm -f a.out
-2
View File
@@ -23,8 +23,6 @@ fi
clear
"${CC}" -Describe -Door westley.c
"${CC}" -Describe -Drain westley.c
"${CC}" -Describe -Dwarf westley.c
+119
View File
@@ -0,0 +1,119 @@
#include <stdio.h>
int main()
{
#if rop&onut&((own&rain)|warf)
printf("The orc scrambles to the drain,\n"
"trying to get the donut; you\n"
"run out the door and escape!\n"
"\n"
" The End\n");
return 0;
#else
#if escribe
#if ocument
printf("It reads:\n"
" Depress Dotted Dog\n");
return 0;
#else
#if oor
printf("The door is decorated with relief\n"
"figures of various dog breeds.\n");
return 0;
#else
#if rain
printf("Through the drain you see a dwarf\n"
"in another cell.\n");
return 0;
#else
#if warf
printf("The gnarled dwarf looks thirsty.\n");
return 0;
#else
#if ungeon|ebris
printf("You notice a desk, a phone, and\n"
"a phone directory among the clutter.\n");
return 0;
#else
#if esk
printf("There are some dimes on the desk.\n");
return 0;
#else
#if irectory
printf("It reads:\n"
" Pixie's Pub -\n"
" instant service -\n"
" Dial DUNgeon0614\n");
return 0;
#else
printf("You notice nothing unusual.\n");
return 0;
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#else
#if ial&UNgeon0614
printf("Pixie takes your order, and\n"
"magically, the room is filled\n"
"with banana daiquiris.\n");
return 0;
#endif
#if rink&aiquiri
printf("As you drink, a voice from\n"
"below says 'Could you drop\n"
"one down here?'\n");
return 0;
#endif
#if rop&aiquiri
#if warf|own
printf("The dwarf eagerly accepts\n"
"the drink. 'Thanks! Here,\n"
"I found this, but I can't\n"
"understand it.' He hands\n"
"you a document.\n");
return 0;
#else
printf("You drop the drink\n"
"on the floor.\n");
return 0;
#endif
#endif
#if epress&(almatian|almation)
printf("As you press the dalmatian\n"
"figure, the door opens - only\n"
"to reveal a menacing orc by\n"
"a vending machine (with a\n"
"sign reading 'DEPOSIT MONEY').\n");
return 0;
#endif
#if eposit&(ime|imes)
printf("Donuts spill out; you get\n"
"some, the orc hungrily eats\n"
"the rest.\n");
return 0;
#endif
#if rop&onut
printf("The orc quickly eats the\n"
"donut; he still bars the\n"
"way.\n");
return 0;
#endif
#if rop+epress+ime+eposit+rink+aiquiri+onut==1
printf("Be more specific.\n");
return 0;
#endif
printf("You are in a debris-filled\n"
"dungeon; a door bars the\n"
"way, and sludge trickles into\n"
"a floor drain.\n");
return 0;
#endif
#endif
}
+4
View File
@@ -2001,6 +2001,10 @@ compiler commands and added a script [try.sh](/1994/westley/try.sh) to
automate the spoiler commands to make it easier to see the game in action from
start to finish.
Cody also added the alternate version that will look fine on terminals not set
to 80 columns and the [try.alt.sh](/1994/westley/try.alt.sh) script to automate
the play along the lines of the [try.sh](/1994/westley/try.sh) script.
# <a name="1995"></a>1995