📄 717-718.html
字号:
<HTML>
<HEAD>
<META name=vsisbn content="1571690433"><META name=vstitle content="Black Art of Java Game Programming"><META name=vsauthor content="Joel Fan"><META name=vsimprint content="Sams"><META name=vspublisher content="Macmillan Computer Publishing"><META name=vspubdate content="11/01/96"><META name=vscategory content="Web and Software Development: Programming, Scripting, and Markup Languages: Java"><TITLE>Black Art of Java Game Programming:The Magic Squares Puzzle</TITLE>
<!-- HEADER --><STYLE type="text/css"> <!-- A:hover { color : Red; } --></STYLE><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><script><!--function displayWindow(url, width, height) { var Win = window.open(url,"displayWindow",'width=' + width +',height=' + height + ',resizable=1,scrollbars=yes'); if (Win) { Win.focus(); }}//--></script><SCRIPT><!--function popUp(url) { var Win = window.open(url,"displayWindow",'width=400,height=300,resizable=1,scrollbars=yes'); if (Win) { Win.focus(); }}//--></SCRIPT><script language="JavaScript1.2"><!--function checkForQuery(fm) { /* get the query value */ var i = escape(fm.query.value); if (i == "") { alert('Please enter a search word or phrase'); return false; } /* query is blank, dont run the .jsp file */ else return true; /* execute the .jsp file */}//--></script></HEAD><BODY>
<TABLE border=0 cellspacing=0 cellpadding=0>
<tr>
<td width=75 valign=top>
<img src="../1571690433.gif" width=60 height=73 alt="Black Art of Java Game Programming" border="1">
</td>
<td align="left">
<font face="arial, helvetica" size="-1" color="#336633"><b>Black Art of Java Game Programming</b></font>
<br>
<font face="arial, helvetica" size="-1"><i>by Joel Fan</i>
<br>
Sams, Macmillan Computer Publishing
<br>
<b>ISBN:</b> 1571690433<b> Pub Date:</b> 11/01/96</font>
</td>
</tr>
</table>
<P>
<!--ISBN=1571690433//-->
<!--TITLE=Black Art of Java Game Programming//-->
<!--AUTHOR=Joel Fan//-->
<!--AUTHOR=Eric Ries//-->
<!--AUTHOR=Calin Tenitchi//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Sams//-->
<!--CHAPTER=17//-->
<!--PAGES=717-718//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="713-717.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch18/719-724.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H3><A NAME="Heading25"></A><FONT COLOR="#000077">Suggestion Box</FONT></H3>
<P>The academic nature of this game, combined with its encapsulation into the <I>game_board</I> class, creates some possiblities for enhancements and variations. Here are some suggestions.</P>
<DL>
<DD><B>•</B> Change the rules of the game: The <I>apply_move</I> method of the <I>game_board</I> class could be modified to change the board actions when an area is clicked. Because of the modularity of the game, everything including the solve would still work.
<DD><B>•</B> Modify the <I>solver</I> class: The exhaustive search used is by no means efficient, and there is bound to be a better way. Figuring out new algorithms can be quite challenging and fullfilling (however, implementing them is another story).
<DD><B>•</B> Use the board elsewhere: Want an interesting front page for your Web site that only allows access to those who deserve it? Integrate the game into a password scheme and watch your hit count decrease.
<DD><B>•</B> Expand on the techniques presented: There is a whole world of computing science problems out there just waiting to be solved. Try using the exhaustive search method elsewhere, such as in writing a tic-tac-toe game or something similar.
</DL>
<H3><A NAME="Heading26"></A><FONT COLOR="#000077">Summary</FONT></H3>
<P>That’s the Magic Squares game. It is an example of a simple puzzle game implemented mostly through event handling, but makes good use of multiple classes and has a background thread thrown in for fun. The <I>game_board</I> class encapsulates all the data and actions pertaining to a board complete with high level methods for applying moves and for drawing the board. The <I>solver</I> class demonstrates an exhaustive search approach to solving problems and shows the power that a multithreaded language like Java can provide. It is not a very complex game, but I think there’s always room for academic games like these to challenge puzzle lovers.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="713-717.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="../ch18/719-724.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</BODY>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -