979 984




Linux Unleashed, Third Edition:Games





-->















Previous
Table of Contents
Next




Math Games and Utilities
The following programs are small and interesting, although perhaps not particularly exciting.

Arithmetic
Type arithmetic at the command prompt. You are asked the answer to simple addition questions. This goes on until you type Ctrl+C to exit. A man page is available by typing man arithmetic.
BCD Punch Card Code, Morse Code, Paper Tape Punch Code
Type bcd at the command line to convert text you type to a punched card, type morse to see your text converted to Morse code, or type ppt for paper punch tape output. If the command line doesn’t contain any text to encode, the programs go into interactive mode. Note that the Enter character you must use to finish each line of input gets coded as well. The bcd man page covers all three programs.
Factor
Type factor at the command line. This command provides you with the prime factors of any number you supply. You can type factor <number> to factor just the one number or factor without any number to go into interactive mode. Numbers can range from ×2147483648 to 2147483648. The following is a sample run of Factor:


darkstar:/usr/games$ factor
123
123: 3 41
36
36: 2 2 3 3
1234567
1234567: 127 9721
6378172984028367
factor: ouch
darkstar:/usr/games$


Primes
Type primes at the command prompt. If you include a range on the command line, Primes displays all prime numbers in the range. If no range is included, Primes waits for you to enter a number and then starts displaying primes greater than that number. The program is surprisingly fast! A man page is available by typing man primes.
Multiplayer Game: Hunt
This game requires several players. You have to hook up other terminals to your system (for instance, a character-based terminal to your serial port).

Full Graphics Game: Sasteroids
You must have a VGA or better color display for this game. Type sasteroids at the command prompt. The game takes over the screen, switching you to the color graphics mode. This is a relative of the arcade game Asteroids. The following keys control your ship:


Left-arrow key
Rotate counterclockwise

Right-arrow key
Rotate clockwise

Up-arrow key
Thrust

Down-arrow key
Enables the shield (one per ship)

Left Ctrl key
Fire

Left Alt key
Hyperspace


It takes a while to get the hang of the controls. The layout is very different from the standard arcade control layout. There is no man page available.

Other Thinking Games
The following programs might actually be a bit frustrating to play initially, but they can also provide hours of addictive fun!

Sokoban
Imagine yourself in charge of a warehouse containing a maze and lots of bales of cotton. Each bale is so heavy that you can only push it and not pull it. So don’t push a bale into a spot where you cannot push it out. Each level in this game gets more and more challenging as you attempt to collect all the bales into a loading area where you can move to the next level. The source code is available from sunsite.unc.edu in the file sokoban-src.tar.gz.
DOOM
This exciting, though controversially gory, game is now ported to Linux as well. Complete with sound support and exquisite graphics, this Linux port does its DOS counterpart justice. One problem to keep in mind though, is that your colormaps in X may be mixed up once your cursor moves out of the X terminal you run DOOM under. Two other things to keep in mind—you have to rebuild your kernel to add the sound support and the version 1.666 of DOOM will not run external WAD files. (I recommend that you get the registered version.)

Conquest
This is an elaborate game of global conquest with equally complex instructions and display. At least the files are in an executable form, and you do not have to build them. One thing to remember is to use the xconq file and run xset fp rehash to bring up the correct fonts. A comparable game called Empire is also available in source from tsx-11.mit.edu, but you need a network connection to run this game.
Miscellaneous Demos and Utilities
The following programs may interest you. If you’re a werewolf, Phase of the Moon will be particularly useful!

Caesar
Type caesar at the command line. This program attempts to decrypt encoded words. Type man caesar to see the man page.
Fortune
Type fortune at the command line for your Linux fortune-cookie message.
Number
Type number <number> at the command line. Converts the Arabic number given as <number> (for example, 41) to its equivalent in English (forty-one).
Phase of the Moon
Type pom at the command prompt. The program tells you the current phase of the moon. As the man page mentions, this can be useful in predicting the behavior of others and maybe yourself, too! Type man pom to see the man page.
Rain
Type rain at the command prompt. Your screen becomes rippled like a puddle in a rainstorm. On most Linux console screens, the program runs too fast to look even remotely convincing. Press Ctrl+C to exit.
Worms
Type worms at the command prompt (do not confuse with the worm program, above). This fills your screen with squirming worms. Like rain, the program runs much too fast on a Linux console screen. A man page is available by typing man worms.
Summary
You should now be able to while away the time by sitting at your machine and playing your favorite games. If you haven’t installed the X system yet, maybe this is an extra incentive! This chapter leads you back to some of the previous chapters that you may not have read.


To install the X system, read Chapter 22, “Installing and Configuring XFree86.”
To use several programming languages to write your own games, see Part V, starting with Chapter 25, “gawk.”
To back up your system so you don’t lose your high scores, see Chapter 45, “Backups.”





Previous
Table of Contents
Next














Wyszukiwarka