Format/typo check 2004/vik1

This commit is contained in:
Cody Boone Ferguson committed 2023-11-19 12:44:47 -08:00
1 parent f35cfd7c9a
commit 7bb8f6a988
1 file changed
+20 -17
+20 -17
View File
@@ -42,9 +42,9 @@ Happy touring on the road and in the code!
This program is a complete car race game with a lot of nice features: This program is a complete car race game with a lot of nice features:
* Drive on a road in a 3-d landscape with hills and curves * Drive on a road in a 3D landscape with hills and curves.
* Mountains in the horizon * Mountains in the horizon.
* A sun in the sky when driving during the day. * A sun in the sky when driving during the day.
@@ -68,9 +68,10 @@ This program is a complete car race game with a lot of nice features:
* The best lap time is stored as reference. * The best lap time is stored as reference.
### Build and Run ### Build and Run
Compile the source code and link x libraries if necessary. Compile the source code and link X libraries if necessary.
The program takes three options which have to be typed in a specific The program takes three options which have to be typed in a specific
order as described below. order as described below.
@@ -85,14 +86,14 @@ d - Racing in at night in the dark
Here are a few examples: Here are a few examples:
``` ```
Command line: Description: Command line: Description:
$ ./vik1 Run track 1 at daytime in the summer $ ./vik1 Run track 1 at daytime in the summer
$ ./vik1 a Run track 1 at daytime in the winter $ ./vik1 a Run track 1 at daytime in the winter
$ ./vik1 d Run track 1 at night in the summer $ ./vik1 d Run track 1 at night in the summer
$ ./vik1 3 Run track 3 at daytime in the summer $ ./vik1 3 Run track 3 at daytime in the summer
$ ./vik1 d3 Run track 3 at night in the summer $ ./vik1 d3 Run track 3 at night in the summer
$ ./vik1 ad2 Run track 2 at night in the winter $ ./vik1 ad2 Run track 2 at night in the winter
``` ```
Note that the order in which the argument characters are entered is Note that the order in which the argument characters are entered is
@@ -109,14 +110,14 @@ The main obfuscation is the fact that the program is extremely compact.
There are a few things I didn't want to do, e.g. define `#define` to a There are a few things I didn't want to do, e.g. define `#define` to a
single letter to save some space, or to remove casts to save some space. single letter to save some space, or to remove casts to save some space.
The program uses a lot of variables. In fact, all letters a-z are used The program uses a lot of variables. In fact, all letters `a-z` are used
and most letters A-Z. and most letters `A-Z`.
The constants are chosen very carefully and they have multiple purposes, The constants are chosen very carefully and they have multiple purposes,
e.g. a constant can be both the length of the track and a color. e.g. a constant can be both the length of the track and a color.
Most of the code is kept inside five for loops each without a body. Each for Most of the code is kept inside five `for` loops each without a body. Each `for`
loop does many things. One for loop draws all cars by restarting a loop does many things. One `for` loop draws all cars by restarting a
couple of times. Another draws the road, mountains, and the sun. couple of times. Another draws the road, mountains, and the sun.
`main()` is called recursively. The return value and output depends on the `main()` is called recursively. The return value and output depends on the
@@ -126,12 +127,14 @@ the entry point of the application.
The program frequently uses the `?:` operator mainly to save space but it The program frequently uses the `?:` operator mainly to save space but it
makes the program more obscure. makes the program more obscure.
### Compiler warnings ### Compiler warnings
There are no compiler warnings when compiling with -ansi but there are There are no compiler warnings when compiling with `-ansi` but there are
quite many warnings from lclint. Mainly because the program is very many warnings from lclint. Mainly because the program is very
optimized for code size. optimized for code size.
### Limitations ### Limitations
The program only compiles and runs on X based systems. The program only compiles and runs on X based systems.
@@ -139,7 +142,7 @@ The program only compiles and runs on X based systems.
The program requires a display with 24 bit color depth. It also assumes The program requires a display with 24 bit color depth. It also assumes
that the byte order of the colors are as on my Linux PC. That is, The that the byte order of the colors are as on my Linux PC. That is, The
colors are represented by a 32 bit value where the bytes (from high to colors are represented by a 32 bit value where the bytes (from high to
low) are { 0, RED, GREEN, BLUE }. low) are `{ 0, RED, GREEN, BLUE }`.
## Copyright and CC BY-SA 4.0 License: ## Copyright and CC BY-SA 4.0 License: