--> Linux
by Ed Trejis
IN THIS CHAPTER
Various games come with Linux. The games can be roughly divided between those that require the X Window system to run and those that will run in plain text mode. In this chapter, you will learn about both types. The chapter provides a reasonably complete list of both X- and character-based games.
The games listed in this chapter come in several different installation packages, so you might not have one or more of these games on your system. For instance, the graphical versions of Tetris, GNU Chess, and Xfractint are each installed separately.
If one of the listed games sounds intriguing, you might want to install it if you haven't done so already.
The following games require X Window to run.
As X Window is a graphical, windowing environment, you might guess that X games are graphically oriented. You would be right! Almost all of the following games use color and bitmapped graphics. Often, you can specify the palette of colors the game will use.
However, you should keep in mind the following:
Following is a discussion of the X games you should find on your system. Keep in mind that installation differences might mean that you have more or fewer games.
If you use the X display manager xdm and use the olwm or olvwm window manager, the xdm root menu (usually accessed by holding down the right mouse button while the cursor is in the root screen area) has a Games submenu choice. From the Games menu, you can then choose a Demo/Gadgets submenu. If you use a different window manager, such as Motif, your menus will be correspondingly different.
The menu choices are listed here. The games they start are described in detail later in this chapter.
The Games menu features the following entries:
The Demos/Gadgets submenu contains the following:
The following games can be started by typing the appropriate command at the Linux prompt in a command-line window. These, and any other games you may install, can be added to the Games menu if you desire.
This is double-deck solitaire. There is no difference in the play of Spider (small) and Spider (large). The difference is that the small Spider game uses smaller cards, and therefore fits into a smaller window than the large Spider game.
To see this game's man page, type man spider.
To start this game, type spider in a command-line window.
This game requires a fair bit of thought, planning, and skill. The aim is to arrange cards of the same suit in descending order. You can also, however, have cards of different suits arranged in descending order. Sometimes this can help you immediately, but hinder you in the long run! Note that, if you do have two or more consecutive cards of the same suit, the cards will move as a group. Spider is challenging; don't try to play it just to pass the time!
This is a superior version of the game, usually a cheap party favor at a child's party, in which you push around 15 numbered tiles on a 16x16 grid, trying to get the numbers in order.
To see this game's man page, type man puzzle.
To start this game, type puzzle in a command-line window.
The reason the X version of Puzzle is superior is because the pieces move very smoothly. Let's face it, the party-favor plastic versions kept jamming and sticking. This is a vast improvement.
If you click on the left box, the game will give you a random starting position. Click on the right box and watch the game solve itself! (Try clicking on the right box when the numbers are already in order.)
This is a graphical version of GNU Chess that uses the xboard display system.
If you've never been hooked on Tetris, here's your chance. This is a nice X implementation of a game that always seems to suffer when taken from the video arcade and placed on a home computer.
To see this game's man page, type man xtetris.
To start this game, type xtetris in a command-line window.
The colors are nicely done, and the movement is relatively smooth. However, if you're used to the arcade version of Tetris, watch out for the following:
The purpose of the game? Arrange the pieces so they interlock without gaps. As soon as you create a (horizontal) row that's completely filled, it vaporizes. This is good, because when the pieces stack up to the top, the game is over. (Pity the Cossack doesn't come out and tap his feet when things start to get a little out of control.)
This is an update of the old arcade game, Lunar Lander. You get a bird's-eye view from the window of your lunar lander. By operating the main and directional thruster engines, you attempt to touch down softly on the landing pad. If things go wrong, instead of a bird's-eye view, you get a meteorite's-eye view!
To see this game's man page, type man xlander.
To start this game, type xlander in a command-line window.
You may have problems getting the game to respond to your keyboard input. In that case, the moon's surface is only a short plummet away.
This is an implementation of the old Chinese game. The graphics are attractively done; the ideograms on the pieces are very nice. The game builds your castle for you, of course. This alone speeds things up considerably.
There is no man page for xmahjongg.
Xvier is a relative of tic-tac-toe. On a 5x5 grid, you and the computer take turns placing your pieces; the first to get four pieces in a row, horizontally, diagonally, or vertically, wins. Xvier differs from tic-tac-toe in that you can only select the column where you want to place your playing piece; your piece then falls down the column to the lowest unoccupied row.
To see this game's man page, type man xvier.
To start this game, type xvier in a command-line window.
You can change the level of the computer's play by typing a number between 0 and 9 while in the game. However, in the higher levels, the computer thinks for a long time. Increase the level of play only one at a time. The default level of play is 0; you might not want to exceed 3.
This is halfway between a game and a demo. Don't start this up if insects give you the shivers!
If you have ever lived in a roach-infested building, this will bring back fond (or not-so-fond) memories. Every time you start another copy of Xroach, a new set of roaches goes scurrying around your screen, looking for windows to hide under. Eventually you don't see them--until you move or close some windows!
To see this game's man page, type man xroach.
To start this game, type xroach in a command-line window.
If you start Xroach from the command line, you can add -squish. You can then try to swat the insects by clicking on them. Be warned, however: they're fast. You can also specify what color the roach guts will be, should you succeed in squishing some.
Ico sets a polyhedron (a solid, multisided geometric shape) bouncing around your screen. Depending on the options specified, this three-dimensional polygon can occupy its own window or use the entire root window.
To see this game's man page, type man ico. It can be started from the command line (within X Window) by typing ico. In fact, you should start it from the command line, because of the options available. If you start it from the Demo/Gadgets menu, you will only get a wireframe polygon in its own, small window.
One interesting option you can use from the command line is -colors. If you specify more than one color, you get a multicolored polyhedron, with each face a different color.
With the -colors option, you must type in the colors to be used in the following format: rgb:<red intensity>/<green intensity>/<blue intensity>. The intensities have to be specified in hexadecimal notation; 000 is the lowest value and fff is the highest. For example, the complete command might be
ico -color rgb:000/888/fff rgb:e00/400/b80 rgb:123/789/def
This program is fairly resource-intensive and might slow down your system.
This draws a maze, and then solves it. There is no way you can solve it for yourself. Maze is a demo, not a game. On a fast system, it solves it too quickly to follow!
Not really a game, but cute anyway. Whenever you start Xeyes, you get a large pair of bodiless eyes that follow your cursor's movements. Running four or five copies of Xeyes at once gives your system a surrealistic touch.
To see this game's man page, type man xeyes.
To start this game, type xeyes in a command-line window.
This is a demo of how perfect gases behave, but you don't need a degree in thermodynamics and statistical mechanics to find this fun to watch. You have two chambers side-by-side, with a small opening in the wall between them. The chambers can be set to different temperatures. The neat part is when you place your cursor in one of the chambers and click the left mouse button--every click launches another gas particle in a random direction!
To see this game's man page, type man xgas. Online help also is available.
To start this game, type xgas in a command-line window.
This displays the official X logo.
This is a version of Tetris that uses pieces made up of hexagons. To start the game, type xhextris on an X Window command line. No man page is available.
This is an X version of Minesweeper. You are given a large grid. Some of the squares contain mines. Your job is to flag all of the mines.
This game is started by typing xbombs at the Linux prompt in a command-line window. No man page is available.
Starting Xbombs brings up the playing field, which is a dark gray grid, and a Score window.
You uncover a square by clicking on it with the left mouse button. If you uncover a mine, you are blown up and the game is over!
It's more likely, though, that you will either uncover a number or open up several light gray, blank squares (with no numbers or mines). The number tells you how many mines are found adjacent to that square, horizontally, vertically, or diagonally. For example, a "1" means there is only one mine adjacent to that square. If you've already determined the location of one mine adjacent to a "1" square, then it's safe to uncover all other squares next to the "1" square because they can't possibly contain a mine! In this fashion, you try to deduce the location of the mines. If you happen to uncover a square that has no number (and therefore no mines next to it), the game will automatically uncover the entire numberless area and its border.
When you think you've located a mine, you "sweep" or mark it by clicking on it with the right mouse button (if you click the left button accidentally, and there is indeed a mine there, the game is over). The right button toggles on and off a flag marker. Note that the game does not tell you whether you have correctly placed the flag.
You will soon discover that certain patterns of numbers let you place a mine without any doubt; other times, you have to make an educated guess.
Of course, sometimes you miscalculate and blow up. To restart the game, click with either mouse button in the Score window. If you complete the game successfully, your time will be recorded.
This is a color drawing-and-painting program. Start it from the Linux prompt in a command-line window by typing xpaint. A Tool menu will appear. Start a new canvas from the File menu. The Tool menu holds your drawing and painting implements (brushes, pencils, spray cans, and so on); the palette of colors and patterns is found underneath the canvas.
To see the man page, type man xpaint.
Xfractint is an easy way to get started with fractals. If you're not sure what a fractal is, try this program. It's almost certain that you've seen fractals before.
To see this game's man page, type man xfractint.
To start this game, type xfractint in a command-line window.
This program has an excellent setup; you can immediately generate many different fractals without getting into their detailed specifications or mathematics.
When you start Xfractint, two windows appear: one that will hold the fractal image (initially empty), and another in which you enter your commands. You can go into the Type selection and choose the type of fractal to generate; or you can click on Select video mode, which starts drawing a fractal in the image window. The default fractal is one of the Mandelbrot types.
When the image has been fully generated (it can take some time), you can go to the command window, type t, and select another type of fractal from the large list of available choices. At this point, you shouldn't have to change the defaults the program gives you. There are enough different types available.
To exit Xfractint, press the Esc key twice from the command window.
There is a long history of games being written for the UNIX operating system. Your Linux /usr/games directory contains a number of these games, from various time periods.
Many of these games were written before color, bitmapped windowing systems became common. All the games in /usr/games, except for Sasteroids, are character-based. This means that all graphics (if there are any!) are displayed on your screen using standard screen characters: A, *, |, x, and so on. In addition, all input is from the keyboard (again, Sasteroids is an exception).
An advantage of character-based games is that they do not require a graphical or windowing environment to run. A monochrome display is fine.
The character-based nature of some games, such as Hangman or Bog (Boggle), takes nothing away from the play; you don't really wish for fancy color graphics when playing them. Other character-based games might strike you as interesting historical curiosities: they show you what their ingenious programmers could manage with such a simple display system, but clearly would be better served by color graphics.
The games found in /usr/games can be roughly categorized into the following types:
These games follow the classic text-based formula: the system informs you that "you are in a maze of small twisty passages, all alike" or something similar; you type in your actions as go forward, east, take sword, and so on. If you like solving puzzles, these games will appeal to you. With text-based games, the adventure follows a defined path, and your responses are usually limited.
The following example is the start of the text-based game Battlestar, which you will learn about in the next section. Your commands are typed at the >-: prompt:
Version 4.2, fall 1984. First Adventure game written by His Lordship, the honorable Admiral D.W. Riggle This is a luxurious stateroom. The floor is carpeted with a soft animal fur and the great wooden furniture is inlaid with strips of platinum and gold. Electronic equipment built into the walls and ceiling is flashing wildly. The floor shudders and the sounds of dull explosions rumble though the room. From a window in the wall ahead comes a view of darkest space. There is a small adjoining room behind you, and a doorway right. >-: right These are the executive suites of the battlestar. Luxurious staterooms carpeted with crushed velvet and adorned with beaten gold open onto this parlor. A wide staircase with ivory banisters leads up or down. This parlor leads into a hallway left. The bridal suite is right. Other rooms lie ahead and behind you. >-: up You are at the entrance to the dining hall. A wide staircase with ebony banisters leads down here. The dining hall is to the ahead. >-: bye
Your rating was novice.
Battlestar Type battlestar at the command prompt. A sample session is shown in the code in the previous section. You can access a man page by typing man battlestar. Dungeon Type dungeon at the command prompt. Typing help at the game prompt gives you useful information. You start out-of-doors and you have to find the dungeon entrance. There is no man page for Dungeon. Paranoia Type paranoia at the command prompt. In this humorous game, you play a secret agent on a desperate mission. Unlike most text-based adventure games, Paranoia lets you choose your actions from a menu. This is useful if you hate having to find a command that the game will understand. There is no man page for Paranoia. Wump Type wump at the command prompt. You are out hunting the Wumpus, armed with some custom arrows and relying on your wits and sense of smell. When you start the game, you are given the choice of seeing the instructions.
Type man wumpus to see the man page.
The following two games are versions of popular word-finding and word-guessing games. Boggle Type bog at the command prompt. This is a version of the Parker Brothers game Boggle Deluxe. You are given a 5x5 grid of letters. In the allotted time of three minutes, you type in words made up from the given letters. By default, you must use letters that adjoin horizontally, vertically, and diagonally, without reusing any letters. Plurals and different tenses count as different words--for instance, "use," "uses," "used," and "user" are all allowed in your word list. This follows the official Boggle rules. You can change these defaults, if you want.
At the end, the computer displays the list of words which it found. You can never beat the computer, because it only allows you to type in real words. You will discover that the Boggle dictionary has some odd omissions; this can be annoying, but it isn't very serious.
This game works well without color graphics, although the small size of the letter grid makes your eyes blur after a while.
You can access a man page by typing man bog. Hangman Type hangman at the command prompt. You won't miss the color graphics. The game is self- explanatory, but just in case, a man page is available; type man hangman. Hangman picks its words at random; sometimes the choices seem quite impossible to guess.
Because of the lack of graphics, the following games are not as successful as the character-based word games. Canfield Type canfield at the command prompt. This is a version of solitaire. You can access a man page by typing man canfield. This game does not have the time-wasting potential of graphics and mouse-based solitaire games. Cribbage Type cribbage at the command prompt. If you're a cribbage fan, this game is for you. You can access a man page by typing man cribbage. Go Fish Type fish at the command prompt. It's you against the computer at Go Fish. A man page is available by typing man fish. One confusing aspect is that sometimes several actions are displayed all together on the screen (for instance, you have to go fish, the computer has to go fish, and it's back to you, all in one block).
These are character-based versions of board games. The play quality is variable; Backgammon is probably the best of the lot. Backgammon Type backgammon at the command prompt; or, for an easy-to-follow tutorial on how to play Backgammon, type teachgammon. These games don't suffer from lack of graphics, but the lack of a pointing device such as a mouse means that specifying your moves is a cumbersome task, requiring entries such as 8-12,4-5. Typing ? at the game prompt gives you help on entering your moves.
Typing man backgammon gives you the manual entry for both Backgammon and Teachgammon. Chess Several chess and chess-related programs come in the GNU Chess package. Type gnuchess at the prompt to play chess against the computer. There is an analysis program, gnuan. The game utility prints the chessboard position to a PostScript printer or file.
Enter your moves using standard algebraic notation--for instance, e2-4.
This is an elaborate package; you should start by reading the man page.
Mille Miglia Type mille at the command prompt. This is the Linux version of a Parker Brothers racing game. You should read the man page before starting, because the game's commands are not very intuitive. To see the man page, type man mille. Monopoly Type monop at the command prompt. This is a character-based version of the Parker Brothers game Monopoly. The computer does not actually play; it simply keeps track of who owns what and how much money each player has. You can play by yourself, but it's pretty obvious that you will, eventually, win! Unfortunately, the board is not displayed in any form, making it quite difficult to keep track of what's happening. This is an interesting effort, but the play is poor. A man page is available.
The following games let you try your hand at being in charge. They are open-ended, in that each game is different and does not follow a canned plot. They combine character graphics, for instance a radar display, with text readouts and text-based commands. Air Traffic Control Type atc at the command prompt. Type man atc and read the man page first; otherwise, you will be responsible for one or more air tragedies! This game runs in real time. A good supply of caffeine will probably help you do well. Sail Type sail at the command prompt. You have a choice of over 20 scenarios, mainly historical battles involving sailing ships. You are the captain, and determine what course to sail and what weapons to use. You can access a man page by typing man sail; it's worth reading beforehand, because some commands are obscure or confusing. Trek Type trek at the command prompt. You can "go where no one has gone before," hunt (and be hunted by) Klingons, and so on. You can access a man page by typing man trek; read it before playing, to avoid being a disgrace to the Federation.
The following games all rely on a full-screen display, although all graphics are assembled from the standard character set. Robots Type robots at the command prompt. Robots on the screen pursue you; your only hope is to make two robots collide, at which point the robots explode. The resulting junk heap destroys any robots that run into it. You move about the screen using the hjkl keys, as used by the vi editor (diagonal movement is allowed, using yubn). Moves are simultaneous: each time you move, so do the robots. Sometimes, though, you have to teleport to get out of an impossible situation. You die if a robot touches you; otherwise, after clearing the screen, you go on to a bigger and better wave of robots. You can access a man page by typing man robots.
Snake Type snake at the command prompt. Use the hjkl keys to move around, picking up money (the $) while avoiding the snake (made up, appropriately, of s characters). The snake gets hungrier as you get richer. Escape the room by running to the # character, or be eaten by the snake! You can also type w in an emergency to warp to a random location. You can access a man page by typing man snake. Tetris Type tetris at the command prompt. The Tetris play screen is drawn with clever use of various characters. Ironically, although it does not look anywhere near as professional as Xtetris or other full-graphics versions, it plays very well--especially if you're used to the arcade version of Tetris. The movement keys consist of , to move left, / to move right, and . to rotate (counterclockwise!). The spacebar drops the piece. You can vary the control keys by using options with the tetris command. See the man page (type man tetris) for details. Worm Type worm at the command prompt. You are a worm, moving about the screen and eating numbers. As you eat the numbers, you grow in length. Do not run into yourself or into the wall! How long can you get before you (inevitably) run into something? Note that you still slowly crawl forward, even if you don't enter a move command.
You can access a man page by typing man worm.
The following programs are small and interesting, although perhaps not that 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. You can access a man page 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 -2,147,483,648 to 2,147,483,648. 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! You can access a man page by typing man primes.
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).
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 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 |
The following programs might actually be a bit frustrating to play with initially, but they can also provide hours of addiction! 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.
The following programs might interest you. If you're a werewolf, the fourth one 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 if you type man worms.
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 Window system yet, maybe this is the extra incentive you need!