Bug fix 2001/ctk and alt code added
Fixed bug where if one does not hit 'q' it would mess up the terminal on exit. I think (but I'm also distracted) this happened if you crashed as well. Now if you kill the game (ctrl-c for instance), you crash or you quit with 'q' it should still be a sane terminal. The alt code adds (it does not replace) vi(m) movement keys: h for left, l for right and k for straight. Format/typo check README.md file.
This commit is contained in:
1 parent
be64048e3d
commit
b127660a5c
4 files changed
+44
-22
No files matched your search
+5
-2
@@ -114,8 +114,8 @@ OBJ= ${PROG}.o
|
||||
DATA=
|
||||
TARGET= ${PROG}
|
||||
#
|
||||
ALT_OBJ=
|
||||
ALT_TARGET=
|
||||
ALT_OBJ= ${PROG}.alt.o
|
||||
ALT_TARGET= ${PROG}.alt
|
||||
|
||||
|
||||
#################
|
||||
@@ -138,6 +138,9 @@ ${PROG}: ${PROG}.c
|
||||
alt: data ${ALT_TARGET}
|
||||
@${TRUE}
|
||||
|
||||
${PROG}.alt: ${PROG}.alt.c
|
||||
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
||||
|
||||
# data files
|
||||
#
|
||||
data: ${DATA}
|
||||
|
||||
+30
-18
@@ -4,6 +4,9 @@
|
||||
make
|
||||
```
|
||||
|
||||
There is an alternate version with vi(m) key movements. See [alternate
|
||||
code](#alternate code) below.
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
@@ -12,14 +15,24 @@ make
|
||||
```
|
||||
|
||||
|
||||
### Try:
|
||||
## Alternate code:
|
||||
|
||||
This alternate version adds to the movement keys `l` for right, `h` for left and
|
||||
`k` for straight.
|
||||
|
||||
|
||||
### Alternate build:
|
||||
|
||||
|
||||
```sh
|
||||
echo "Do or do not. There is no try."
|
||||
make alt
|
||||
```
|
||||
|
||||
Make sure to hit `q` to exit or else your terminal will be messed up (to restore
|
||||
it you can try `stty sane` or `reset`).
|
||||
### Alternate use:
|
||||
|
||||
```sh
|
||||
./ctk.alt
|
||||
```
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
@@ -32,20 +45,19 @@ This is, of course, another of the retro games.
|
||||
|
||||
## Author's remarks:
|
||||
|
||||
This is a game based on an Apple ][ Print Shop Companion [Easter
|
||||
egg][1] named 'DRIVER', in which the goal is to drive as fast as
|
||||
you can down a long twisty highway without running off the
|
||||
road. Use `,./`, `[ ]`, or `bnm` to go left, straight, and
|
||||
right respectively. Use `1234` to switch gears. `q` quits. The
|
||||
faster you go and the thinner the road is, the more points you
|
||||
get. Most of the obfuscation is in the nonsensical if statements
|
||||
among other things. It works best on the Linux console: you
|
||||
get engine sound (!) and the * Lock keyboard lights tell you
|
||||
what gear you're in (none lit=4th). The `q` argument (no
|
||||
leading `-`) will silence the sound. It won't work on a terminal
|
||||
smaller than 80x24, but it works fine with more (try it in an
|
||||
XTerm with the "Unreadable" font and the window maximized
|
||||
vertically!).
|
||||
This is a game based on an [Apple
|
||||
II](https://en.wikipedia.org/wiki/Apple_II_series) [Print Shop
|
||||
Companion](https://en.wikipedia.org/wiki/The_Print_Shop) [Easter egg][1] named
|
||||
'DRIVER', in which the goal is to drive as fast as you can down a long twisty
|
||||
highway without running off the road. Use `,./`, `[ ]`, or `bnm` to go left,
|
||||
straight, and right respectively. Use `1234` to switch gears. `q` quits. The
|
||||
faster you go and the thinner the road is, the more points you get. Most of the
|
||||
obfuscation is in the nonsensical if statements among other things. It works
|
||||
best on the Linux console: you get engine sound (!) and the * Lock keyboard
|
||||
lights tell you what gear you're in (none lit=4th). The `q` argument (no
|
||||
leading `-`) will silence the sound. It won't work on a terminal smaller than
|
||||
80x24, but it works fine with more (try it in an XTerm with the "Unreadable"
|
||||
font and the window maximized vertically!).
|
||||
|
||||
[1]: https://en.wikipedia.org/wiki/Easter_egg_(media)#In_computing
|
||||
|
||||
|
||||
+1
-1
@@ -22,4 +22,4 @@ SIG_IGN);printf("\e[0q\ecScore: %u\n",s);system("stty echo -cbreak");}int main
|
||||
int)0x756E696C||C==(int)0x6C696E75);srand(getpid());system("stty -echo cbreak"
|
||||
);h(0);u(14);for(;;)switch(getchar()){case 113:return 0;case 91:case 98:c(44,k
|
||||
=-1);case 32:case 110:c(46,k=0);case 93:case 109:c(47,k=1);c(49,h(0));c(50,h(1
|
||||
));c(51,h(2));c(52,h(3));}}
|
||||
));c(51,h(2));c(52,h(3));}e();}
|
||||
+8
-1
@@ -2517,7 +2517,14 @@ sound devices in macOS).
|
||||
## [2001/ctk](2001/ctk/ctk.c) ([README.md](2001/ctk/README.md]))
|
||||
|
||||
The ANSI escape codes were no longer valid but Yusuke provided a patch to fix
|
||||
the ANSI escape codes. Cody tested this for macOS and it works fine.
|
||||
the ANSI escape codes. This works with both linux and macOS.
|
||||
|
||||
Cody fixed this so that it should always restore terminal sanity (echo enabled
|
||||
etc.) after exiting even if you don't press 'q', if you crash or if you kill the
|
||||
program prematurely.
|
||||
|
||||
Cody also added the [alt code](2001/ctk/README.md#alternate-code) that adds
|
||||
vi(m) movement keys.
|
||||
|
||||
|
||||
## [2001/dgbeards](2001/dgbeards/dgbeards.c) ([README.md](2001/dgbeards/README.md]))
|
||||
|
||||
Reference in new issue
Block a user