Merge branch 'xexyl-duble15-try'
Trying to resolve a GitHub pull request conflict. *sigh*
This commit is contained in:
commit
211b7f28ab
48 files changed
+1578
-164
No files matched your search
@@ -58,7 +58,7 @@ ARCH=
|
|||||||
|
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DZ=500
|
CDEFINE= -DZ=${SLEEP}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
@@ -137,6 +137,13 @@ ${PROG}: ${PROG}.c
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
# variable to control amount of time to sleep between writes for alt code.
|
||||||
|
SLEEP=500
|
||||||
|
|
||||||
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
|
${CC} ${CFLAGS} -DZ=${SLEEP} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
data: ${DATA}
|
data: ${DATA}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ make alt
|
|||||||
```
|
```
|
||||||
|
|
||||||
To see why we recommend the alternate version instead of the original version,
|
To see why we recommend the alternate version instead of the original version,
|
||||||
see below and the [original code](#original-code) section.
|
see below and the [Original code](#original-code) section.
|
||||||
|
|
||||||
|
|
||||||
### Try:
|
### Try:
|
||||||
@@ -25,7 +25,7 @@ reconfigure it like:
|
|||||||
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make CDEFINE+="-DZ=700" clobber alt
|
make SLEEP=700 clobber alt
|
||||||
```
|
```
|
||||||
|
|
||||||
which would set it at 700. Then, whether you use the default value or not, try:
|
which would set it at 700. Then, whether you use the default value or not, try:
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ ARCH=
|
|||||||
|
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DC=39
|
CDEFINE= -DC=${SIZE}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
@@ -136,8 +136,11 @@ ${PROG}: ${PROG}.c
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
# variable to control size of maze for alt code
|
||||||
|
SIZE= 39
|
||||||
|
|
||||||
${PROG}.alt: ${PROG}.alt.c
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
${CC} ${CFLAGS} -DC=${SIZE} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ make all
|
|||||||
```
|
```
|
||||||
|
|
||||||
There is alternate code which allows one to change the size of the maze. See
|
There is alternate code which allows one to change the size of the maze. See
|
||||||
[alternate code](#alternate-code) below.
|
[Alternate code](#alternate-code) below.
|
||||||
|
|
||||||
|
|
||||||
### To run:
|
### To run:
|
||||||
@@ -32,7 +32,7 @@ make alt
|
|||||||
If you wish to change the value you can do it like:
|
If you wish to change the value you can do it like:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DC=5" alt
|
make clobber SIZE=5 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that if it is not a number then obviously there will be a compilation
|
Note that if it is not a number then obviously there will be a compilation
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ while ((i < 5)); do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -n 1 -p "Press any key to set to $C: "
|
read -r -n 1 -p "Press any key to set to $C: "
|
||||||
make clobber CC="$CC" CDEFINE="-DC=$C" alt >/dev/null
|
echo 1>&2
|
||||||
|
make clobber CC="$CC" SIZE="$C" alt >/dev/null
|
||||||
./shapiro.alt
|
./shapiro.alt
|
||||||
((i++))
|
((i++))
|
||||||
done
|
done
|
||||||
@@ -39,7 +40,7 @@ while :; do
|
|||||||
# ^-- SC2143 (style): Use grep -q instead of comparing output with [ -n .. ].
|
# ^-- SC2143 (style): Use grep -q instead of comparing output with [ -n .. ].
|
||||||
# shellcheck disable=SC2143
|
# shellcheck disable=SC2143
|
||||||
if [[ $(echo "$REPLY" | grep -E '\<[0-9]+\>') ]]; then
|
if [[ $(echo "$REPLY" | grep -E '\<[0-9]+\>') ]]; then
|
||||||
make clobber CC="$CC" CDEFINE="-DC=\"$REPLY\"" alt >/dev/null
|
make clobber CC="$CC" SIZE="$REPLY" alt >/dev/null
|
||||||
./shapiro.alt
|
./shapiro.alt
|
||||||
else
|
else
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
+4
-2
@@ -58,7 +58,7 @@ ARCH=
|
|||||||
|
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DMAX_MOVES=484
|
CDEFINE= -DMAX_MOVES=${MAXMOVES}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
@@ -137,11 +137,13 @@ ${PROG}: ${PROG}.c
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
# variable to control max number of moves
|
||||||
|
MAXMOVES= 484
|
||||||
${PROG}.alt: ${PROG}.alt.c
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
${PROG}2.alt: ${PROG}.alt2.c
|
${PROG}2.alt: ${PROG}.alt2.c
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
${CC} ${CFLAGS} -DMAX_MOVES=${MAXMOVES} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -20,9 +20,10 @@ that's fewer than the original program.
|
|||||||
|
|
||||||
The first alternate version, [rince.alt.c](rince.alt.c), disables a maximum move
|
The first alternate version, [rince.alt.c](rince.alt.c), disables a maximum move
|
||||||
count so that anyone with enough patience and time can complete the puzzle,
|
count so that anyone with enough patience and time can complete the puzzle,
|
||||||
without having to worry about how many moves they make. The second version,
|
without having to worry about how many moves they make, assuming they don't get
|
||||||
[rince.alt2.c](rince.alt2.c), allows one to reconfigure at compilation the
|
stuck. The second version, [rince.alt2.c](rince.alt2.c), allows one to
|
||||||
maximum number of moves, even if that is lowering the count.
|
reconfigure at compilation the maximum number of moves, even if that is lowering
|
||||||
|
the count.
|
||||||
|
|
||||||
The author set the maximum number of moves to 484.
|
The author set the maximum number of moves to 484.
|
||||||
|
|
||||||
@@ -39,12 +40,13 @@ restrictions in the number of movements and the second one, `rince.alt2`, has a
|
|||||||
configurable maximum number of moves allowed, defaulting to the entry's max,
|
configurable maximum number of moves allowed, defaulting to the entry's max,
|
||||||
484.
|
484.
|
||||||
|
|
||||||
To reconfigure the maximum number of moves:
|
To reconfigure the maximum number of moves to 700:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE+="-DMAX_MOVES=5" alt
|
make clobber MAXMOVES=700 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Alternate use:
|
### Alternate use:
|
||||||
|
|
||||||
To run the first alt version:
|
To run the first alt version:
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ ARCH=
|
|||||||
|
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DZ=20000
|
CDEFINE= -DZ=${SLEEP}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
@@ -138,6 +138,12 @@ ${PROG}: ${PROG}.c
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
# variable to control amount of time to sleep between writes for alt code.
|
||||||
|
SLEEP= 20000
|
||||||
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
|
${CC} ${CFLAGS} -DZ=${SLEEP} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
data: ${DATA}
|
data: ${DATA}
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ Also try changing the speed this game moves. For instance if you wish to change
|
|||||||
the `usleep(3)` value to `30000` from `20000`, try:
|
the `usleep(3)` value to `30000` from `20000`, try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DZ=30000" alt # make it slower
|
make clobber SLEEP=30000 alt # make it slower
|
||||||
|
|
||||||
make clobber CDEFINE="-DZ=10000" alt # make it faster
|
make clobber SLEEP=10000 alt # make it faster
|
||||||
```
|
```
|
||||||
|
|
||||||
Then use the same syntax as above and described by the author.
|
Then use the same syntax as above and described by the author.
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ ARCH=
|
|||||||
|
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DZ=100
|
CDEFINE= -DZ=${SLEEP}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
@@ -141,8 +141,11 @@ chris: ${PROG}
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
# variable to control how long to sleep in alt version between updates
|
||||||
|
SLEEP= 100
|
||||||
|
|
||||||
${PROG}.alt: ${PROG}.alt.c
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
${CC} ${CFLAGS} -DZ=${SLEEP} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ make alt
|
|||||||
To configure how many microseconds to sleep before updates try:
|
To configure how many microseconds to sleep before updates try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DZ=200" alt
|
make clobber SLEEP=200 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
NOTE: this entry requires `X11/Xlib.h` header file and the X11 library to
|
NOTE: this entry requires `X11/Xlib.h` header file and the X11 library to
|
||||||
@@ -32,7 +32,6 @@ STATUS: known bug - please help us fix
|
|||||||
For more detailed information see [1993 cmills in bugs.md](/bugs.md#1993-cmills).
|
For more detailed information see [1993 cmills in bugs.md](/bugs.md#1993-cmills).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## To use:
|
## To use:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ ARCH=
|
|||||||
|
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DZ=200
|
CDEFINE= -DZ=${SLEEP}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
@@ -138,8 +138,10 @@ ${PROG}: ${PROG}.c
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
# variable to control how long to sleep in alt version
|
||||||
|
SLEEP= 200
|
||||||
${PROG}.alt: ${PROG}.alt.c
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
${CC} ${CFLAGS} -DZ=${SLEEP} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ make alt
|
|||||||
If you wish to change the time to sleep (default `200`) you can do so like:
|
If you wish to change the time to sleep (default `200`) you can do so like:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DZ=50" alt
|
make clobber SLEEP=50 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
jkb
|
jkb
|
||||||
|
jkb.alt
|
||||||
|
jkb.alt2
|
||||||
rince
|
rince
|
||||||
rince.orig
|
rince.orig
|
||||||
rince.alt
|
rince.alt
|
||||||
|
|||||||
+19
-1
@@ -58,7 +58,7 @@ ARCH=
|
|||||||
|
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DZ=17
|
CDEFINE= -DZ=${SLEEP}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
@@ -143,6 +143,24 @@ jkb: ${PROG}
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
# variable to control how long to sleep in alt version
|
||||||
|
SLEEP= 17
|
||||||
|
|
||||||
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
|
${CC} ${CFLAGS} -DZ=${SLEEP} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
|
${PROG}.alt2: ${PROG}.alt2.c
|
||||||
|
${CC} ${CFLAGS} -DZ=${SLEEP} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
|
jkb.alt: ${PROG}.alt
|
||||||
|
${RM} -f $@
|
||||||
|
${LN} $< $@
|
||||||
|
|
||||||
|
jkb.alt2: ${PROG}.alt
|
||||||
|
${RM} -f $@
|
||||||
|
${LN} $< $@
|
||||||
|
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
data: ${DATA}
|
data: ${DATA}
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ STATUS: INABIAF - please **DO NOT** fix
|
|||||||
For more detailed information see [1993 rince in bugs.md](/bugs.md#1993-rince).
|
For more detailed information see [1993 rince in bugs.md](/bugs.md#1993-rince).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## To use:
|
## To use:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -61,7 +59,7 @@ changed).
|
|||||||
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make CDEFINE="-DZ=18" clobber alt
|
make SLEEP=18 clobber alt
|
||||||
```
|
```
|
||||||
|
|
||||||
Replace 18 with whatever number you wish.
|
Replace 18 with whatever number you wish.
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ ARCH=
|
|||||||
|
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DW=3
|
CDEFINE= -DW=${ARROWS}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
@@ -138,8 +138,11 @@ ${PROG}: ${PROG}.c
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
# variable to allow overriding how many arrows to start with
|
||||||
|
ARROWS= 3
|
||||||
|
|
||||||
${PROG}.alt: ${PROG}.alt.c
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
${CC} ${CFLAGS} -DW=${ARROWS} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ The default number of arrows in this version is 3 but if you want to change it,
|
|||||||
say to 5, try:
|
say to 5, try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DW=5" alt
|
make clobber ARROWS=5 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+14
-5
@@ -57,11 +57,21 @@ CSTD= -std=gnu90
|
|||||||
#
|
#
|
||||||
ARCH=
|
ARCH=
|
||||||
|
|
||||||
|
# variables that control the control keys
|
||||||
|
|
||||||
|
IT= XK_Page_Up
|
||||||
|
DT= XK_Page_Down
|
||||||
|
UP= XK_Up
|
||||||
|
DN= XK_Down
|
||||||
|
LT= XK_Left
|
||||||
|
RT= XK_Right
|
||||||
|
CS= XK_Return
|
||||||
|
dt= 0.02
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DIT=XK_Page_Up -DDT=XK_Page_Down \
|
CDEFINE= -DIT=${IT} -DDT=${DT} \
|
||||||
-DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \
|
-DUP=${UP} -DDN=${DN} -DLT=${LT} -DRT=${RT} \
|
||||||
-DCS=XK_Return -Ddt=0.02
|
-DCS=${CS} -Ddt=${dt}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
@@ -142,8 +152,7 @@ alt: data ${ALT_TARGET}
|
|||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
${PROG}.alt: ${PROG}.c
|
${PROG}.alt: ${PROG}.c
|
||||||
${CC} ${CFLAGS} -UIT -UDT -DIT=XK_f -DDT=XK_d -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \
|
${CC} ${CFLAGS} -UIT -UDT -DIT=XK_f -DDT=XK_d $< -o $@ ${LDFLAGS}
|
||||||
-DCS=XK_Return -Ddt=0.02 $< -o $@ ${LDFLAGS}
|
|
||||||
|
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
|
|||||||
+76
-53
@@ -4,10 +4,59 @@
|
|||||||
make all
|
make all
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
You may redefine all the keys and the time step with predefined macros. The
|
||||||
|
author provided the following able:
|
||||||
|
|
||||||
|
```
|
||||||
|
Control Description Default Key
|
||||||
|
------- ------------------------- -----------
|
||||||
|
IT Increase throttle XK_Page_Up
|
||||||
|
DT Decrease throttle XK_Page_Down
|
||||||
|
FD Move stick forward XK_Up
|
||||||
|
BK Move stick back XK_Down
|
||||||
|
LT Move stick left XK_Left
|
||||||
|
RT Move stick right XK_Right
|
||||||
|
CS Center stick XK_Enter
|
||||||
|
```
|
||||||
|
|
||||||
|
There is another macro, `dt`, which is the time step. See some important points
|
||||||
|
on this in the author's comments in the [Alternate Build
|
||||||
|
Instructions](#alternate-build-instructions) section.
|
||||||
|
|
||||||
|
If however you wish to change the above controls, see the header file
|
||||||
|
[keysym.h](keysym.h) for the definitions of other characters that you might wish
|
||||||
|
to use. The name of the macro in the header file is what you need to set the
|
||||||
|
macros to, depending on what controls you wish to redefine. For instance, to set
|
||||||
|
the throttle up and down to `u` and `d`:
|
||||||
|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make clobber IT=XK_u DT=XK_d all
|
||||||
|
```
|
||||||
|
|
||||||
|
because in the header file you can see that `XK_u` corresponds to `u` and `XK_d`
|
||||||
|
corresponds to `d`:
|
||||||
|
|
||||||
|
```c
|
||||||
|
#define XK_d 0x0064 /* U+0064 LATIN SMALL LETTER D */
|
||||||
|
#define XK_u 0x0075 /* U+0075 LATIN SMALL LETTER U */
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that the [keysym.h](keysym.h) file is not complete from X11; it's just the
|
||||||
|
more likely candidates (and some that are probably unlikely :-) ).
|
||||||
|
|
||||||
|
The upper case letters would be `XK_U` and `XK_D` and you can search the header
|
||||||
|
file for 'LATIN CAPITAL D', for example.
|
||||||
|
|
||||||
For those who do not have a Page Up or Page Down key, see [alternate
|
For those who do not have a Page Up or Page Down key, see [alternate
|
||||||
code](#alternate-code) below. The same method may be used if you wish to
|
code](#alternate-code) below. The difference from the alt build and the original
|
||||||
redefine other keys but the alt build sets a default for those without page up
|
entry is that the page up and page down keys are defined to a default but they
|
||||||
and page down.
|
are hard coded as doing otherwise would necessarily complicate the build
|
||||||
|
instructions. Since you can use the original entry to redefine these this is not
|
||||||
|
a problem and is purely a convenience .. if only for those who are okay with the
|
||||||
|
preselected alternative keys.
|
||||||
|
|
||||||
|
|
||||||
## To use:
|
## To use:
|
||||||
@@ -33,62 +82,35 @@ you can regain control?
|
|||||||
If you do not have access to a page up or page down key, for instance you're
|
If you do not have access to a page up or page down key, for instance you're
|
||||||
using a Mac, you can use the alt code (though it actually uses the same code)
|
using a Mac, you can use the alt code (though it actually uses the same code)
|
||||||
that will redefine the keys to increase throttle and decrease throttle. This
|
that will redefine the keys to increase throttle and decrease throttle. This
|
||||||
same method can be used with the original code but this is sets up a default for
|
same method can be used with the original code but this sets up predefined keys
|
||||||
the missing keys of Macs.
|
in place of Page Up and Page Down.
|
||||||
|
|
||||||
The keys were somewhat arbitrarily selected but it was decided to make them on
|
The keys were somewhat arbitrarily selected but it was decided to make them both
|
||||||
the left side of the keyboard as one might have a harder time using the arrows
|
on the left side of a QWERTY keyboard as one might have a harder time using the
|
||||||
at the same time as typing on the right side.
|
arrows at the same time as typing on the right side.
|
||||||
|
|
||||||
|
|
||||||
### Alternate build:
|
### Alternate build:
|
||||||
|
|
||||||
As the Makefile allows you to configure the keys to use you may redefine the
|
As the Makefile allows you to configure the keys to use you may redefine the
|
||||||
keys. This can be done for both versions but if you don't have certain keys it's
|
keys but with the alt build you cannot, as described earlier, redefine the page
|
||||||
even more important. In the main program increasing throttle is by page up and
|
up and page down replacement keys. If you want to do that you should use the
|
||||||
decreasing throttle is page down. In the alt build it is `f` and `d`
|
original entry as described in the to build section above.
|
||||||
respectively as these are letters on the left side of the keyboard which is
|
|
||||||
easier to use if one is using the right side for movement.
|
|
||||||
|
|
||||||
To use the default changes:
|
In the alt build it is `f` and `d` respectively as these are letters on the left
|
||||||
|
side of the keyboard which is easier to use if one is using the right side for
|
||||||
|
movement. These are hard coded, as noted.
|
||||||
|
|
||||||
|
To use the default settings for the alternate build:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make alt
|
make alt
|
||||||
```
|
```
|
||||||
|
|
||||||
If however you wish to change these, see the header file [keysym.h](keysym.h)
|
You may change the other keys as described in the build instructions, above, but
|
||||||
for the definitions of other characters that you might wish to use. The name of
|
this alt code can be seen as an alternative for those who don't have or don't
|
||||||
the macro in the header file is what you need to set the macros in the Makefile
|
want to use page up and page down.
|
||||||
to, depending on what controls you wish to redefine.
|
|
||||||
|
|
||||||
For instance if you want to use 'u' to increase throttle and 'd' to decrease
|
|
||||||
throttle you would do:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
make clobber CDEFINE="-UIT -UDT -DIT=XK_u -DDT=XK_d -DUP=XK_Up -DDN=XK_Down -DLT=XK_Left -DRT=XK_Right \
|
|
||||||
-DCS=XK_Return" alt
|
|
||||||
```
|
|
||||||
|
|
||||||
because in the header file you can see that `XK_u` corresponds to `u` and `XK_d`
|
|
||||||
corresponds to `d`:
|
|
||||||
|
|
||||||
```c
|
|
||||||
#define XK_d 0x0064 /* U+0064 LATIN SMALL LETTER D */
|
|
||||||
#define XK_u 0x0075 /* U+0075 LATIN SMALL LETTER U */
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that you must specify all keys and other `-D` macros if you redefine any of
|
|
||||||
them.
|
|
||||||
|
|
||||||
The upper case letters would be `XK_U` and `XK_D` and you can search the header
|
|
||||||
file for 'LATIN CAPITAL D', for example.
|
|
||||||
|
|
||||||
See [alternate build instructions](#alternate-build-instructions) for the proper
|
|
||||||
macro names. You may do the above for the entry itself as well, of course, if
|
|
||||||
you do not like the defaults selected.
|
|
||||||
|
|
||||||
Note that the [keysym.h](keysym.h) file is not complete from X11; it's just the
|
|
||||||
more likely candidates (and some that are probably unlikely :-) ).
|
|
||||||
|
|
||||||
|
|
||||||
### Alternate use:
|
### Alternate use:
|
||||||
@@ -133,6 +155,7 @@ indicator, or compass. 0 is north, 90 is east, 180 is south,
|
|||||||
270 is west. The third instrument is the altimeter, which
|
270 is west. The third instrument is the altimeter, which
|
||||||
measures your height above ground level in feet.
|
measures your height above ground level in feet.
|
||||||
|
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
* Simulator models a [Piper
|
* Simulator models a [Piper
|
||||||
@@ -241,8 +264,10 @@ to default values. Use this section if you want to compile with
|
|||||||
different options.
|
different options.
|
||||||
|
|
||||||
To map a key to a control, you must pass an option to the
|
To map a key to a control, you must pass an option to the
|
||||||
compiler in the format `-Dcontrol=key`. The possible controls
|
compiler in the format `-Dcontrol=key` or if you use the Makefile you can do
|
||||||
you can map are described in the table below:
|
`make control=key`.
|
||||||
|
|
||||||
|
The possible controls you can map are described in the table below:
|
||||||
|
|
||||||
```
|
```
|
||||||
Control Description Default Key
|
Control Description Default Key
|
||||||
@@ -260,16 +285,14 @@ Values for the possible keys can be found in the X Windows
|
|||||||
header file `<X11/keysym.h>`. This file is most likely a
|
header file `<X11/keysym.h>`. This file is most likely a
|
||||||
cross-reference to another header, `<X11/keysymdef.h>`.
|
cross-reference to another header, `<X11/keysymdef.h>`.
|
||||||
|
|
||||||
You must map all seven controls to keys at compile time, or the
|
|
||||||
compilation will fail.
|
|
||||||
|
|
||||||
For example, to map Center Stick to the space-bar, the compile
|
For example, to map Center Stick to the space-bar, the compile
|
||||||
option would be `-DCS=XK_space`.
|
option would be `-DCS=XK_space` or `make CS=XK_space`.
|
||||||
|
|
||||||
|
|
||||||
To set the time step size, you must pass the following option to
|
To set the time step size, you must pass the following option to
|
||||||
the compiler: `-Ddt=duration`, where `dt` is literal, and where
|
the compiler: `-Ddt=duration`, where `dt` is literal, and where
|
||||||
`duration` is the time in seconds you want the time step to be.
|
`duration` is the time in seconds you want the time step to be. Alternatively,
|
||||||
|
if you use the provided Makefile, you may just do `make dt=time`.
|
||||||
|
|
||||||
Two things to keep in mind when selecting a time step. Time
|
Two things to keep in mind when selecting a time step. Time
|
||||||
steps that are too large (more than about `0.03`) will cause
|
steps that are too large (more than about `0.03`) will cause
|
||||||
|
|||||||
@@ -55,10 +55,13 @@ CSTD= -std=gnu90
|
|||||||
#
|
#
|
||||||
ARCH=
|
ARCH=
|
||||||
|
|
||||||
|
# variable for size, primarily for alt code
|
||||||
|
#
|
||||||
|
SIZE=32767
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DM0=sizeof -DM1=long -DM2=void \
|
CDEFINE= -DM0=sizeof -DM1=long -DM2=void \
|
||||||
-DM3=realloc -DM4=calloc -DM5=free -DSZ=32767
|
-DM3=realloc -DM4=calloc -DM5=free -DSZ=${SIZE}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
@@ -138,6 +141,11 @@ ${PROG}: ${PROG}.c
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
|
||||||
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
|
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
||||||
|
${LN} -sf $@ samefile.alt
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
data: ${DATA}
|
data: ${DATA}
|
||||||
|
|||||||
@@ -54,11 +54,10 @@ If you wish to change the size to say, 55555:
|
|||||||
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DSZ=55555" alt
|
make clobber SIZE=55555 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
or whatever you wish to redefine it to. See [alternate code](#alternate-code)
|
or whatever you wish to redefine it to.
|
||||||
below.
|
|
||||||
|
|
||||||
|
|
||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
|
|||||||
@@ -56,9 +56,13 @@ CSTD= -std=gnu99
|
|||||||
#
|
#
|
||||||
ARCH=
|
ARCH=
|
||||||
|
|
||||||
|
# variables for redefining the time to sleep, primarily for alt code
|
||||||
|
#
|
||||||
|
SLEEP= 30
|
||||||
|
SDL_SLEEP= 150000
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DZ=30 -DZS=150000
|
CDEFINE= -DZ=${SLEEP} -DZS=${SDL_SLEEP}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -37,8 +37,10 @@ You might also care to reconfigure the speed at which the programs run. The code
|
|||||||
calls `usleep(3)` with two default values, one for SDL and one for curses. The
|
calls `usleep(3)` with two default values, one for SDL and one for curses. The
|
||||||
curses and SDL macros are defined respectively in the Makefile:
|
curses and SDL macros are defined respectively in the Makefile:
|
||||||
|
|
||||||
```
|
```make
|
||||||
-DZ=30 -DZS=150000
|
SLEEP= 30
|
||||||
|
SDL_SLEEP= 150000
|
||||||
|
CDEFINE= -DZ=${SLEEP} -DZS=${SDL_SLEEP}
|
||||||
```
|
```
|
||||||
|
|
||||||
which corresponds to how long the program sleeps (in microseconds) between
|
which corresponds to how long the program sleeps (in microseconds) between
|
||||||
@@ -47,19 +49,20 @@ to the defaults as above so that you don't have to specify both just to
|
|||||||
configure one. To change the SDL one to something like `15000` you can do:
|
configure one. To change the SDL one to something like `15000` you can do:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make CDEFINE="-DZS=15000" clobber alt
|
make SDL_SLEEP=15000 clobber alt
|
||||||
```
|
```
|
||||||
|
|
||||||
and to change the curses one to `40`:
|
and to change the curses one to `40`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make CDEFINE="-DZ=40" clobber alt
|
make SLEEP=40 clobber alt
|
||||||
```
|
```
|
||||||
|
|
||||||
Then use the program(s) in the same way.
|
Then use the program(s) in the same way.
|
||||||
|
|
||||||
The different macros is because the curses version is already much slower and so
|
The different macros is because the curses version is already much slower and so
|
||||||
it's better to not tie the two values together.
|
it's better to not tie the two values together. You may of course combine them
|
||||||
|
in one command.
|
||||||
|
|
||||||
|
|
||||||
## Original code:
|
## Original code:
|
||||||
|
|||||||
+7
-1
@@ -57,9 +57,15 @@ CSTD= -std=gnu99
|
|||||||
#
|
#
|
||||||
ARCH=
|
ARCH=
|
||||||
|
|
||||||
|
# variables for the macros for easier redefining
|
||||||
|
#
|
||||||
|
PORT= 5455
|
||||||
|
SPEED= 100
|
||||||
|
L= "socket(il.sin_family=AF_INET,SOCK_STREAM,0)"
|
||||||
|
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DPORT=5455 -DSPEED=100 -Dl_="socket(il.sin_family=AF_INET,SOCK_STREAM,0)"
|
CDEFINE= -DPORT=${PORT} -DSPEED=${SPEED} -Dl_=${L}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
|
|||||||
+6
-5
@@ -42,23 +42,24 @@ If you need to change the speed you can reconfigure it like (say
|
|||||||
for over a network and not the same host):
|
for over a network and not the same host):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DSPEED=50" all # original default value which is very fast
|
make clobber SPEED=50 all # original default value which is very fast
|
||||||
```
|
```
|
||||||
|
|
||||||
If you wish to change the port you can do so like:
|
If you wish to change the port you can do so like:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DPORT=3773" all
|
make clobber PORT=3773 all
|
||||||
```
|
```
|
||||||
|
|
||||||
Of course if you want a port < 1024 you'll need to be root so don't do that.
|
Of course if you want a port < 1024 you'll need to be root so don't do that.
|
||||||
|
|
||||||
And if you know what you're doing you can redefine the call to the `socket(2)`
|
And if you know what you're doing you can redefine the call to the `socket(2)`
|
||||||
syscall with the `l_` macro. Of course you can do more than one at the same
|
syscall with the `l_` macro, changing the `L` variable like one would `PORT`. Of
|
||||||
time. For instance to change the speed and port:
|
course you can do more than one at the same time. For instance to change the
|
||||||
|
speed and port:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DSPEED=512 -DPORT=3773" all
|
make clobber SPEED=512 PORT=3773 all
|
||||||
```
|
```
|
||||||
|
|
||||||
If you have `xterm` try on one system:
|
If you have `xterm` try on one system:
|
||||||
|
|||||||
@@ -56,9 +56,13 @@ CSTD= -std=gnu99
|
|||||||
#
|
#
|
||||||
ARCH=
|
ARCH=
|
||||||
|
|
||||||
|
# variables for the macros for easier redefining
|
||||||
|
XX= 1024
|
||||||
|
YY= 768
|
||||||
|
AA= 3
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DXX=1024 -DYY=768 -DAA=3
|
CDEFINE= -DXX=${XX} -DYY=${YY} -DAA=${AA}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -46,17 +46,17 @@ make alt
|
|||||||
To change the default size from 1024x768 try:
|
To change the default size from 1024x768 try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DXX=640 -DYY=480" alt
|
make clobber XX=640 YY=480 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
You might also wish to change the anti-alias setting:
|
You might also wish to change the anti-alias setting:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DAA=2" alt
|
make clobber AA=2 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
This is not possible with the author's version but it is with the Windows
|
This is not possible with the author's version but it is with the alt versions
|
||||||
version (see below).
|
(Windows - see below - and otherwise).
|
||||||
|
|
||||||
As the Windows version will not compile on most viewers' systems we do not build
|
As the Windows version will not compile on most viewers' systems we do not build
|
||||||
it with `make alt`; instead try:
|
it with `make alt`; instead try:
|
||||||
|
|||||||
@@ -56,9 +56,12 @@ CSTD= -ansi
|
|||||||
#
|
#
|
||||||
ARCH=
|
ARCH=
|
||||||
|
|
||||||
|
# variable for redefining macro Ag
|
||||||
|
#
|
||||||
|
Ag= 11
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DAg=11
|
CDEFINE= -DAg=${Ag}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ you wish to make it silver, 47 (a prime) protons, do:
|
|||||||
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DAg=47" alt
|
make clobber Ag=47 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
though it might be odd to have 47 numbers on a line as it would defeat the
|
though it might be odd to have 47 numbers on a line as it would defeat the
|
||||||
@@ -60,7 +60,7 @@ purpose. :-) Or if you prefer some prime, golden irony:
|
|||||||
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DAg=79" alt
|
make clobber Ag=79 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -143,8 +143,14 @@ ${PROG}: ${PROG}.c
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
# variables to help redefine width, height or iterations in alt version
|
||||||
|
#
|
||||||
|
WIDTH= 400
|
||||||
|
HEIGHT= 300
|
||||||
|
ITERATIONS= 128
|
||||||
|
|
||||||
${PROG}.alt: ${PROG}.alt.c
|
${PROG}.alt: ${PROG}.alt.c
|
||||||
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
${CC} ${CFLAGS} -DW=${WIDTH} -DH=${HEIGHT} -DI=${ITERATIONS} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ Make sure you have the SDL1 (not SDL2!) development environment installed.
|
|||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
There is alternate code that lets you redefine the width and height and number
|
There is alternate version that lets you redefine the width and height and number
|
||||||
of iterations to use. See [alternate code](#alternate-code) below.
|
of iterations to use. See [Alternate code](#alternate-code) below.
|
||||||
|
|
||||||
|
|
||||||
### Bugs and (Mis)features:
|
### Bugs and (Mis)features:
|
||||||
@@ -67,13 +67,13 @@ of the variables `W`, `H` and `I`. The defaults are (respectively) 400, 300 and
|
|||||||
the same then do:
|
the same then do:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DW=500 -DH=500" alt
|
make clobber WIDTH=500 HEIGHT=500 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
If you wish to keep the dimensions the same but change the iterations to 512:
|
If you wish to keep the dimensions the same but change the iterations to 512:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make clobber CDEFINE="-DI=512" alt
|
make clobber ITERATIONS=512 alt
|
||||||
```
|
```
|
||||||
|
|
||||||
If you specify a value less than 1 for any of these it sets it back to the
|
If you specify a value less than 1 for any of these it sets it back to the
|
||||||
|
|||||||
@@ -57,9 +57,12 @@ CSTD= -std=gnu99
|
|||||||
#
|
#
|
||||||
ARCH=
|
ARCH=
|
||||||
|
|
||||||
|
# variable to simplify redefining sleep duration for alt code
|
||||||
|
#
|
||||||
|
SLEEP= 75000
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -DS=75000
|
CDEFINE= -DS=${SLEEP}
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ value used in `usleep()`. The default is `-DS=75000` but you can easily change
|
|||||||
it. To do so try:
|
it. To do so try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make CDEFINE="-DS=70000" clobber alt
|
make clobber SLEEP=70000 clobber alt
|
||||||
./sloane.alt
|
./sloane.alt
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ If you wish to make it like the original, as if the below [Original
|
|||||||
code](#original-code) was being used, you can do:
|
code](#original-code) was being used, you can do:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make CDEFINE="-DS=0" clobber alt
|
make SLEEP=0 clobber alt
|
||||||
./sloane.alt
|
./sloane.alt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+44
-30
@@ -4,6 +4,9 @@
|
|||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
There is an alternate version of this entry, discussed in the author's remarks.
|
||||||
|
See [Alternate code](#alternate-code) below.
|
||||||
|
|
||||||
|
|
||||||
## To use:
|
## To use:
|
||||||
|
|
||||||
@@ -15,36 +18,34 @@ echo Some text | ./prog
|
|||||||
### Try:
|
### Try:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
echo Hello, world | ./prog
|
./try.sh
|
||||||
|
|
||||||
DRAFT=1 ./prog < prog.c
|
|
||||||
|
|
||||||
./prog
|
|
||||||
> [type]
|
|
||||||
(...observe...)
|
|
||||||
|
|
||||||
./prog < prog.c
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Alternate code:
|
## Alternate code:
|
||||||
|
|
||||||
An alternate version of this entry, prog.alt.c, is provided. This alternate
|
This alternate code, provided by the author, is discussed in more detail by the
|
||||||
code is discussed below in the "prog.c vs prog.alt.c" section of the Author's
|
author in the 'prog.c vs prog.alt.c' section of their remarks.
|
||||||
comments below.
|
|
||||||
|
|
||||||
To compile this alternate version:
|
|
||||||
|
|
||||||
make alt
|
### Alternate build:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make alt
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Alternate use:
|
||||||
|
|
||||||
Use `prog.alt` as you would `prog` above.
|
Use `prog.alt` as you would `prog` above.
|
||||||
|
|
||||||
### Selected Judges Remarks:
|
|
||||||
|
### Judges' remarks:
|
||||||
|
|
||||||
Beautiful penmanship! However, your fonts may vary.
|
Beautiful penmanship! However, your fonts may vary.
|
||||||
|
|
||||||
How does this entry compress the font it uses? What's the purpose of lrand48()?
|
How does this entry compress the font it uses? What's the purpose of
|
||||||
Why does the program dump core, when it does :) ?
|
`lrand48(3)`? Why does the program dump core, when it does :) ?
|
||||||
|
|
||||||
|
|
||||||
## Author's remarks:
|
## Author's remarks:
|
||||||
@@ -54,13 +55,14 @@ Why does the program dump core, when it does :) ?
|
|||||||
This program **prints text in your terminal with an interesting
|
This program **prints text in your terminal with an interesting
|
||||||
hand-writing effect**.
|
hand-writing effect**.
|
||||||
|
|
||||||
It uses the *braille patterns* range of the unicode standard: this
|
It uses the *Braille patterns* range of the unicode standard: this
|
||||||
allows to consider each terminal character as a tiny 2x4 bitmap.
|
allows to consider each terminal character as a tiny 2x4 bitmap.
|
||||||
|
|
||||||
Turning the Braille code into something visual might be considered
|
Turning the Braille code into something visual might be considered
|
||||||
blasphemous. When I was fighting to make this program work, I started
|
blasphemous. When I was fighting to make this program work, I started
|
||||||
wondering if it was not the reason for its very erratic behaviour.
|
wondering if it was not the reason for its very erratic behaviour.
|
||||||
|
|
||||||
|
|
||||||
### prog.c vs prog.alt.c
|
### prog.c vs prog.alt.c
|
||||||
|
|
||||||
The file `prog.alt.c` is the one I submitted.
|
The file `prog.alt.c` is the one I submitted.
|
||||||
@@ -71,30 +73,36 @@ with other compilers or optimization levels). These have been fixed in `prog.c`.
|
|||||||
After this fix, in order to remain rule-2-compliant, a variable name has also
|
After this fix, in order to remain rule-2-compliant, a variable name has also
|
||||||
been shortened in this file.
|
been shortened in this file.
|
||||||
|
|
||||||
|
|
||||||
### How to build
|
### How to build
|
||||||
|
|
||||||
If you have `clang`:
|
If you have `clang`:
|
||||||
|
|
||||||
$ CC=clang make -e
|
```sh
|
||||||
|
CC=clang make -e
|
||||||
|
```
|
||||||
|
|
||||||
Otherwise (gcc):
|
Otherwise (gcc):
|
||||||
|
|
||||||
$ make
|
```sh
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
(You will get a few warnings in this case.)
|
(You will get a few warnings in this case.)
|
||||||
|
|
||||||
|
|
||||||
### How to use it
|
### How to use it
|
||||||
|
|
||||||
You need a terminal configured to handle a *UTF-8* encoding and a font including
|
You need a terminal configured to handle a *UTF-8* encoding and a font including
|
||||||
*braille patterns*.
|
*Braille patterns*.
|
||||||
|
|
||||||
This is the default on most modern GNU/Linux operating systems.
|
This is the default on most modern GNU/Linux operating systems.
|
||||||
|
|
||||||
The default terminal application (gnome-terminal) or even a simple xterm should
|
The default terminal application (gnome-terminal) or even a simple xterm should
|
||||||
render things properly.
|
render things properly.
|
||||||
|
|
||||||
I tested this on several Debian and Ubuntu systems, 32 and 64bits (no
|
I tested this on several Debian and Ubuntu systems, 32 and 64bits and no
|
||||||
configuration was needed).
|
configuration was needed.
|
||||||
|
|
||||||
I also tested it on FreeBSD 9.3 32bits (font and encoding configuration was
|
I also tested it on FreeBSD 9.3 32bits (font and encoding configuration was
|
||||||
needed in this case).
|
needed in this case).
|
||||||
@@ -123,9 +131,9 @@ $ ./prog
|
|||||||
This entry is obfuscated in various ways:
|
This entry is obfuscated in various ways:
|
||||||
|
|
||||||
* The structure is hidden by avoiding loops, `if` statements, ternary
|
* The structure is hidden by avoiding loops, `if` statements, ternary
|
||||||
conditionals, and jump-related instructions. Instead, recursivity is heavily
|
conditionals, and jump-related instructions. Instead, recursion is heavily
|
||||||
used.
|
used.
|
||||||
* Merging all functions into one added even more recursivity. ;)
|
* Merging all functions into one added even more recursion. ;)
|
||||||
* The provided code does not contain the same number of opening and closing
|
* The provided code does not contain the same number of opening and closing
|
||||||
parenthesis.
|
parenthesis.
|
||||||
* Preprocessing the code inflates it and adds lots of indents. Removing some
|
* Preprocessing the code inflates it and adds lots of indents. Removing some
|
||||||
@@ -144,8 +152,8 @@ On the other hand, the following may help:
|
|||||||
|
|
||||||
* The code layout should help to identify which part of the code is
|
* The code layout should help to identify which part of the code is
|
||||||
obfuscated. ;)
|
obfuscated. ;)
|
||||||
* File 'codes.txt' shows how each character is drawn. This data is encoded in
|
* File [codes.txt](codes.txt) shows how each character is drawn. This data is
|
||||||
macro `O_o` at the top of the source file.
|
encoded in macro `O_o` at the top of the source file.
|
||||||
|
|
||||||
|
|
||||||
### Limitations:
|
### Limitations:
|
||||||
@@ -160,23 +168,27 @@ a-z, A-Z, '.' ':' ',' ';' '!' and '?'.
|
|||||||
```
|
```
|
||||||
|
|
||||||
Uppercase and lowercase chars are rendered the same. The program also understand
|
Uppercase and lowercase chars are rendered the same. The program also understand
|
||||||
the space and the linefeed (\n). Other chars are simply ignored (most of the
|
the space and the linefeed (`\n`). Other chars are simply ignored (most of the
|
||||||
time ;)
|
time ;)
|
||||||
|
|
||||||
|
|
||||||
#### Stack size
|
#### Stack size
|
||||||
|
|
||||||
This limitation is due to the heavy use of recursivity. After having processed a
|
This limitation is due to the heavy use of recursion. After having processed a
|
||||||
large number of characters, the process may exceed the stack size and crash.
|
large number of characters, the process may exceed the stack size and crash.
|
||||||
(However I did not experience this myself. The top-level recursion might be
|
(However I did not experience this myself. The top-level recursion might be
|
||||||
removed by the compiler as part of its optimizations.)
|
removed by the compiler as part of its optimizations.)
|
||||||
|
|
||||||
|
|
||||||
#### Line rendering
|
#### Line rendering
|
||||||
|
|
||||||
The program does its best to avoid cutting words at the end of lines, but it
|
The program does its best to avoid cutting words at the end of lines, but it
|
||||||
could still happen in case of long words.
|
could still happen in case of long words.
|
||||||
|
|
||||||
|
|
||||||
### Subtleties and extra features
|
### Subtleties and extra features
|
||||||
|
|
||||||
|
|
||||||
#### Handling more than text docs?
|
#### Handling more than text docs?
|
||||||
|
|
||||||
Given the limited set of characters handled, the program is mostly limited to
|
Given the limited set of characters handled, the program is mostly limited to
|
||||||
@@ -185,12 +197,13 @@ simple text documents.
|
|||||||
Thus, if you try for example:
|
Thus, if you try for example:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ ./prog < prog.c\
|
$ ./prog < prog.c
|
||||||
```
|
```
|
||||||
|
|
||||||
You will not get something that looks like C code. (but you can still try, if
|
You will not get something that looks like C code. (but you can still try, if
|
||||||
you are curious. :)
|
you are curious. :)
|
||||||
|
|
||||||
|
|
||||||
#### A 'draft' mode
|
#### A 'draft' mode
|
||||||
|
|
||||||
Defining an environment variable called DRAFT will enable the 'draft-mode'.
|
Defining an environment variable called DRAFT will enable the 'draft-mode'.
|
||||||
@@ -202,6 +215,7 @@ $ echo 'testing the draft mode' | DRAFT=1 ./prog
|
|||||||
|
|
||||||
The program will run much faster but the rendering will be less precise.
|
The program will run much faster but the rendering will be less precise.
|
||||||
|
|
||||||
|
|
||||||
#### The subtle interactive mode
|
#### The subtle interactive mode
|
||||||
|
|
||||||
I saved the best for last: usually, programs that handle an "interactive mode"
|
I saved the best for last: usually, programs that handle an "interactive mode"
|
||||||
|
|||||||
Executable
+38
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# try.sh - demonstrate IOCCC winner 2015/duble
|
||||||
|
#
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
echo "$ echo \"Hello, world!\" | ./prog" 1>&2
|
||||||
|
echo "Hello, world!" | ./prog
|
||||||
|
|
||||||
|
echo "$ echo \"IOCCC 2015\" | ./prog" 1>&2
|
||||||
|
echo "IOCCC 2015" | ./prog
|
||||||
|
|
||||||
|
echo "$ DRAFT=1 ./prog < prog.c" 1>&2
|
||||||
|
DRAFT=1 ./prog < prog.c
|
||||||
|
|
||||||
|
echo "$ ./prog < prog.c" 1>&2
|
||||||
|
./prog < prog.c
|
||||||
|
|
||||||
|
echo "$ ./prog < lorem-ipsum.txt" 1>&2
|
||||||
|
./prog < lorem-ipsum.txt
|
||||||
|
|
||||||
|
echo "Type in text, hitting enter after each line." 1>&2
|
||||||
|
echo "Watch the output each time and try again." 1>&2
|
||||||
|
echo "Hit ctrl-c to exit." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "$ ./prog" 1>&2
|
||||||
|
./prog
|
||||||
+1
-1
@@ -22,7 +22,7 @@ echo "" | ./prog
|
|||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
|
|
||||||
A good start for understanding this entry might be
|
A good start for understanding this entry might be
|
||||||
https://www.ietf.org/rfc/rfc1321.txt. How does it compute this using only a
|
[rfc1321.txt](rfc1321.txt). How does it compute this using only a
|
||||||
single looping construct? The original reference source code for this
|
single looping construct? The original reference source code for this
|
||||||
algorithm is about 355 lines of code, yet this entry is only 199 lines with
|
algorithm is about 355 lines of code, yet this entry is only 199 lines with
|
||||||
one statement per line and it isn't using lots of macro expansion tricks like
|
one statement per line and it isn't using lots of macro expansion tricks like
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Trival err.h
|
* Trivial err.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __err_h__
|
#ifndef __err_h__
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* 4 state, 2 symbol busy beaver, http://www.logique.jussieu.fr/~michel/ha.html#tm42
|
* 4 state, 2 symbol busy beaver, https://web.archive.org/web/20150926094245/http://www.logique.jussieu.fr/~michel/ha.html#tm42
|
||||||
*
|
*
|
||||||
* halts after 107 steps
|
* halts after 107 steps
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* 2 state, 4 symbol current champion, http://www.logique.jussieu.fr/~michel/ha.html#tm24
|
* 2 state, 4 symbol current champion, https://web.archive.org/web/20150926094245/http://www.logique.jussieu.fr/~michel/ha.html#tm24
|
||||||
*
|
*
|
||||||
* halts after 3932964 steps
|
* halts after 3932964 steps
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* chaos machine, http://www.drb.insel.de/~heiner/BB/mabu90.html
|
* chaos machine, https://web.archive.org/web/20131104160623/http://www.drb.insel.de/~heiner/BB/mabu90.html
|
||||||
*
|
*
|
||||||
* does not halt (http://www.drb.insel.de/~heiner/BB/TM4-proof.txt)
|
* does not halt (https://web.archive.org/web/20131104203330/http://www.drb.insel.de/~heiner/BB/TM4-proof.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define sym_1(sym, _1) sym
|
#define sym_1(sym, _1) sym
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* complex machine, http://www.drb.insel.de/~heiner/BB/mabu90.html
|
* complex machine, https://web.archive.org/web/20131104160623/http://www.drb.insel.de/~heiner/BB/mabu90.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define sym_1(sym, _1) sym
|
#define sym_1(sym, _1) sym
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* counting machine, http://www.drb.insel.de/~heiner/BB/mabu90.html
|
* counting machine, https://web.archive.org/web/20131104160623/http://www.drb.insel.de/~heiner/BB/mabu90.html
|
||||||
*
|
*
|
||||||
* does not halt
|
* does not halt
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* greater machine, http://www.drb.insel.de/~heiner/BB/mabu90.html
|
* greater machine, https://web.archive.org/web/20131104160623/http://www.drb.insel.de/~heiner/BB/mabu90.html
|
||||||
*
|
*
|
||||||
* does not halt
|
* does not halt
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* 2 state, 4 symbol current runner-up, http://www.logique.jussieu.fr/~michel/ha.html#tm24
|
* 2 state, 4 symbol current runner-up, https://web.archive.org/web/20150926094245/http://www.logique.jussieu.fr/~michel/ha.html#tm24
|
||||||
*
|
*
|
||||||
* halts after 7195 steps
|
* halts after 7195 steps
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3788,6 +3788,9 @@ output.
|
|||||||
|
|
||||||
## <a name="2015_endoh3"></a>[2015/endoh3](/2015/endoh3/prog.c) ([README.md](/2015/endoh3/README.md]))
|
## <a name="2015_endoh3"></a>[2015/endoh3](/2015/endoh3/prog.c) ([README.md](/2015/endoh3/README.md]))
|
||||||
|
|
||||||
|
[Cody](#cody) added the [try.sh](/2015/duble/try.sh) script.
|
||||||
|
>>>>>>> xexyl-duble15-try
|
||||||
|
|
||||||
[Cody](#cody) fixed this to compile with Linux which was having a problem with duplicate
|
[Cody](#cody) fixed this to compile with Linux which was having a problem with duplicate
|
||||||
symbols of `main()`. The fix is through the compiler option `-fcommon` which
|
symbols of `main()`. The fix is through the compiler option `-fcommon` which
|
||||||
will let it compile like it does with macOS.
|
will let it compile like it does with macOS.
|
||||||
@@ -3802,6 +3805,7 @@ simply typing `make back_to` or `make mullender`.
|
|||||||
[Cody](#cody) added explicit linking of libm (`-lm`) for systems that do not do this
|
[Cody](#cody) added explicit linking of libm (`-lm`) for systems that do not do this
|
||||||
(Linux doesn't seem to but macOS does).
|
(Linux doesn't seem to but macOS does).
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
## <a name="2015_howe"></a>[2015/howe](/2015/howe/prog.c) ([README.md](/2015/howe/README.md))
|
## <a name="2015_howe"></a>[2015/howe](/2015/howe/prog.c) ([README.md](/2015/howe/README.md))
|
||||||
|
|
||||||
@@ -3810,11 +3814,46 @@ and Peace text file, fixed the [avgtime.sh](/2015/howe/avgtime.sh) script (it
|
|||||||
resulted in standard input errors in piping to `bc(/1)`) and added the
|
resulted in standard input errors in piping to `bc(/1)`) and added the
|
||||||
[cc.1](/2015/howe/cc.1) man page as not all systems have it (in fact it's
|
[cc.1](/2015/howe/cc.1) man page as not all systems have it (in fact it's
|
||||||
`gcc(/1)` from Rocky Linux).
|
`gcc(/1)` from Rocky Linux).
|
||||||
|
||||||| 6a936532
|
||||||
|
|
||||||
|
## [2015/howe](2015/howe/prog.c) ([README.md](2015/howe/README.md))
|
||||||
|
|
||||||
|
[Cody](#cody) added the [try.sh](2015/howe/try.sh) script, downloaded the War
|
||||||
|
and Peace text file, fixed the [avgtime.sh](2015/howe/avgtime.sh) script (it
|
||||||
|
resulted in standard input errors in piping to `bc(1)`) and added the
|
||||||
|
[cc.1](2015/howe/cc.1) man page as not all systems have it (in fact it's
|
||||||
|
`gcc(1)` from Rocky Linux).
|
||||||
|
=======
|
||||||
|
Cody also added the RFC 1321 text file, [rfc1321.txt](2015/hou/rfc1321.txt) to
|
||||||
|
the directory, to make it so one need not download it, and which the README.md
|
||||||
|
file now links to.
|
||||||
|
>>>>>>> xexyl-duble15-try
|
||||||
|
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
## <a name="2015_mills1"></a>[2015/mills1](/2015/mills1/prog.c) ([README.md](/2015/mills1/README.md))
|
||||||
|
||||||| 6a936532
|
||||||
|
## [2015/mills1](2015/mills1/prog.c) ([README.md](2015/mills1/README.md))
|
||||||
|
=======
|
||||||
|
## <a name="2015_howe"></a>[2015/howe](/2015/howe/prog.c) ([README.md](/2015/howe/README.md))
|
||||||
|
>>>>>>> xexyl-duble15-try
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
[Cody](#cody) added the [try.sh](/2015/mills1/try.sh) script which changes the
|
||||||
|
||||||| 6a936532
|
||||||
|
[Cody](#cody) added the [try.sh](2015/mills1/try.sh) script which changes the
|
||||||
|
=======
|
||||||
|
[Cody](#cody) added the [try.sh](/2015/howe/try.sh) script, downloaded the War
|
||||||
|
and Peace text file, fixed the [avgtime.sh](/2015/howe/avgtime.sh) script (it
|
||||||
|
resulted in standard input errors in piping to `bc(/1)`) and added the
|
||||||
|
[cc.1](/2015/howe/cc.1) man page as not all systems have it (in fact it's
|
||||||
|
`gcc(/1)` from Rocky Linux).
|
||||||
|
|
||||||
|
|
||||||
## <a name="2015_mills1"></a>[2015/mills1](/2015/mills1/prog.c) ([README.md](/2015/mills1/README.md))
|
## <a name="2015_mills1"></a>[2015/mills1](/2015/mills1/prog.c) ([README.md](/2015/mills1/README.md))
|
||||||
|
|
||||||
[Cody](#cody) added the [try.sh](/2015/mills1/try.sh) script which changes the
|
[Cody](#cody) added the [try.sh](/2015/mills1/try.sh) script which changes the
|
||||||
|
>>>>>>> xexyl-duble15-try
|
||||||
parameters to what we had in the judges' remarks to make it easier (he only died
|
parameters to what we had in the judges' remarks to make it easier (he only died
|
||||||
when he tried to mark a reminder complete on the other side of the screen at the
|
when he tried to mark a reminder complete on the other side of the screen at the
|
||||||
same time and he almost survived that, scoring at that point over 90 - but this
|
same time and he almost survived that, scoring at that point over 90 - but this
|
||||||
|
|||||||
+30
-1
@@ -1,5 +1,5 @@
|
|||||||
# A todo list of known things to check and/or do
|
# A todo list of known things to check and/or do
|
||||||
*Last updated: Wed 06 Dec 2023 13:24:33 UTC*
|
*Last updated: Thu 07 Dec 2023 19:12:36 UTC*
|
||||||
|
|
||||||
This document is primarily for [Cody Boone
|
This document is primarily for [Cody Boone
|
||||||
Ferguson](/winners.html#Cody_Boone_Ferguson) as he (that is I :-) ) wanted a way
|
Ferguson](/winners.html#Cody_Boone_Ferguson) as he (that is I :-) ) wanted a way
|
||||||
@@ -169,3 +169,32 @@ the rest of the entries are done, assuming that it's possible.
|
|||||||
- Although I will have to do this when another issue is opened up I am aware of
|
- Although I will have to do this when another issue is opened up I am aware of
|
||||||
some issues in 2020/ferguson1/.winner.json. I do not want to forget this,
|
some issues in 2020/ferguson1/.winner.json. I do not want to forget this,
|
||||||
however, so I am noting it here.
|
however, so I am noting it here.
|
||||||
|
|
||||||
|
- Finish going through entries (Makefile and README.md files) that have the
|
||||||
|
ability to redefine macros but only in an awkward way like `make clobber
|
||||||
|
CDEFINE="-D.."`. To find entries that were done by me: `git grep -c 'CDEFINE'
|
||||||
|
'*README.md'` but the `2000/thadgavin` is already done. The reference to
|
||||||
|
`CDEFINE` might want to be removed but that can be decided when this is done
|
||||||
|
too. The entries done as of 7 Dec 2023 are:
|
||||||
|
- 2006/sloane
|
||||||
|
- 2006/monge
|
||||||
|
- 2004/jdalbec
|
||||||
|
- 2004/gavare
|
||||||
|
- 2001/kev
|
||||||
|
- 2000/thadgavin
|
||||||
|
- 1998/schweikh3
|
||||||
|
- 1998/banks
|
||||||
|
- 1994/dodsond2
|
||||||
|
- 1993/rince
|
||||||
|
- 1993/plummer
|
||||||
|
- 1993/cmills
|
||||||
|
- 1992/kivinen
|
||||||
|
- 1991/rince
|
||||||
|
- 1985/shapiro
|
||||||
|
- 1985/lycklama
|
||||||
|
... and at least one of them needs to have the thanks file updated as it
|
||||||
|
helps with the original entry itself. This one is 1998/banks but there might
|
||||||
|
be more (and there is at least one not done yet that this will apply I
|
||||||
|
believe).
|
||||||
|
|
||||||
|
|
||||||
Reference in new issue
Block a user