📄 979-984.html
字号:
<HTML>
<HEAD>
<TITLE>Linux Unleashed, Third Edition:Games</TITLE>
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0672313723//-->
<!--TITLE=Linux Unleashed, Third Edition//-->
<!--AUTHOR=Tim Parker//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Sams//-->
<!--CHAPTER=61//-->
<!--PAGES=979-984//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="976-979.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch62/985-987.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading12"></A><FONT COLOR="#000077">Math Games and Utilities</FONT></H4>
<P>The following programs are small and interesting, although perhaps not particularly exciting.
</P>
<P><FONT SIZE="+1"><B>Arithmetic</B></FONT></P>
<P>Type <TT><B>arithmetic</B></TT> at the command prompt. You are asked the answer to simple addition questions. This goes on until you type <TT><B>Ctrl+C</B></TT> to exit. A man page is available by typing <TT><B>man arithmetic</B></TT>.</P>
<P><FONT SIZE="+1"><B>BCD Punch Card Code, Morse Code, Paper Tape Punch Code</B></FONT></P>
<P>Type <TT><B>bcd</B></TT> at the command line to convert text you type to a punched card, type <TT><B>morse</B></TT> to see your text converted to Morse code, or type <TT><B>ppt</B></TT> 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 <TT>bcd</TT> man page covers all three programs.</P>
<P><FONT SIZE="+1"><B>Factor</B></FONT></P>
<P>Type <TT><B>factor</B></TT> at the command line. This command provides you with the prime factors of any number you supply. You can type <TT><B>factor <number></B></TT> to factor just the one number or <TT><B>factor</B></TT> without any number to go into interactive mode. Numbers can range from ×2147483648 to 2147483648. The following is a sample run of Factor:</P>
<!-- CODE //-->
<PRE>
darkstar:/usr/games$ <B>factor</B>
<B>123</B></B>
123: 3 41
<B>36</B></B>
36: 2 2 3 3
<B>1234567</B></B>
1234567: 127 9721
<B>6378172984028367</B>
factor: ouch
darkstar:/usr/games$
</PRE>
<!-- END CODE //-->
<P><FONT SIZE="+1"><B>Primes</B></FONT></P>
<P>Type <TT><B>primes</B></TT> 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 <TT><B>man primes</B></TT>.</P>
<H4 ALIGN="LEFT"><A NAME="Heading13"></A><FONT COLOR="#000077">Multiplayer Game: Hunt</FONT></H4>
<P>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).
</P>
<H4 ALIGN="LEFT"><A NAME="Heading14"></A><FONT COLOR="#000077">Full Graphics Game: Sasteroids</FONT></H4>
<P>You must have a VGA or better color display for this game. Type <TT><B>sasteroids</B></TT> 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:</P>
<CENTER>
<TABLE WIDTH="90%"><TR>
<TD WIDTH="40%">Left-arrow key
<TD WIDTH="60%">Rotate counterclockwise
<TR>
<TD>Right-arrow key
<TD>Rotate clockwise
<TR>
<TD>Up-arrow key
<TD>Thrust
<TR>
<TD>Down-arrow key
<TD>Enables the shield (one per ship)
<TR>
<TD>Left Ctrl key
<TD>Fire
<TR>
<TD>Left Alt key
<TD>Hyperspace
</TABLE>
</CENTER>
<P>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.
</P>
<H4 ALIGN="LEFT"><A NAME="Heading15"></A><FONT COLOR="#000077">Other Thinking Games</FONT></H4>
<P>The following programs might actually be a bit frustrating to play initially, but they can also provide hours of addictive fun!
</P>
<P><FONT SIZE="+1"><B>Sokoban</B></FONT></P>
<P>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 <TT>sunsite.unc.edu</TT> in the file <TT>sokoban-src.tar.gz</TT>.</P>
<P><FONT SIZE="+1"><B>DOOM</B></FONT></P>
<P>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.)
</P>
<P><FONT SIZE="+1"><B>Conquest</B></FONT></P>
<P>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 <TT>xconq</TT> file and run <TT>xset fp rehash</TT> to bring up the correct fonts. A comparable game called Empire is also available in source from <TT>tsx-11.mit.edu</TT>, but you need a network connection to run this game.</P>
<H4 ALIGN="LEFT"><A NAME="Heading16"></A><FONT COLOR="#000077">Miscellaneous Demos and Utilities</FONT></H4>
<P>The following programs may interest you. If you’re a werewolf, Phase of the Moon will be particularly useful!
</P>
<P><FONT SIZE="+1"><B>Caesar</B></FONT></P>
<P>Type <TT><B>caesar</B></TT> at the command line. This program attempts to decrypt encoded words. Type <TT><B>man caesar</B></TT> to see the man page.</P>
<P><FONT SIZE="+1"><B>Fortune</B></FONT></P>
<P>Type <TT><B>fortune</B></TT> at the command line for your Linux fortune-cookie message.</P>
<P><FONT SIZE="+1"><B>Number</B></FONT></P>
<P>Type <TT><B>number <<I>number</I>></B></TT> at the command line. Converts the Arabic number given as <TT><<I>number</I>></TT> (for example, 41) to its equivalent in English (forty-one).</P>
<P><FONT SIZE="+1"><B>Phase of the Moon</B></FONT></P>
<P>Type <TT><B>pom</B></TT> 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 <TT><B>man pom</B></TT> to see the man page.</P>
<P><FONT SIZE="+1"><B>Rain</B></FONT></P>
<P>Type <TT><B>rain</B></TT> 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.</P>
<P><FONT SIZE="+1"><B>Worms</B></FONT></P>
<P>Type <B>worms</B> at the command prompt (do not confuse with the <TT>worm</TT> program, above). This fills your screen with squirming worms. Like <TT>rain</TT>, the program runs much too fast on a Linux console screen. A man page is available by typing <TT><B>man worms</B></TT>.</P>
<H3><A NAME="Heading17"></A><FONT COLOR="#000077">Summary</FONT></H3>
<P>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.
</P>
<DL>
<DD>To install the X system, read Chapter 22, “Installing and Configuring XFree86.”
<DD>To use several programming languages to write your own games, see Part V, starting with Chapter 25, “<TT>gawk</TT>.”
<DD>To back up your system so you don’t lose your high scores, see Chapter 45, “Backups.”
</DL>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="976-979.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch62/985-987.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -