ÄãºÃ£¬»¶Ó­À´µ½¾­¹ÜÖ®¼Ò [µÇ¼] [×¢²á]

ÉèΪÊ×Ò³ | ¾­¹ÜÖ®¼ÒÊ×Ò³ | Êղر¾Õ¾

»ùÓÚJAVAµÄÎå×ÓÆåÉè¼ÆÓëʵÏÖ_¼ÆËã»úרҵÂÛÎÄ·¶ÎÄ

·¢²¼Ê±¼ä£º2015-01-16 À´Ô´£ºÈË´ó¾­¼ÃÂÛ̳
¼ÆËã»úרҵÂÛÎÄ·¶ÎÄ ÕªÒª Îå×ÓÆåÊÇÆðÔ´ÓÚÖйú¹Å´úµÄ´«Í³ºÚ°×ÆåÖÖÖ®Ò»¡£ÏÖ´úÎå×ÓÆåÈÕÎijÆ֮Ϊ¡°ßBÖ顱£¬Ó¢ÒëΪ¡°Renju¡±£¬Ó¢ÎijÆ֮Ϊ¡°Gobang¡±»ò¡°FIR¡±£¨Five in a RowµÄËõд£©£¬ÒàÓС°Á¬Îå×Ó¡±¡¢¡°Îå×ÓÁ¬¡±¡¢¡°´®Ö顱¡¢¡°ÎåÄ¿¡±¡¢¡°ÎåÄ¿Åö¡±¡¢¡°Îå¸ñ¡±µÈ¶àÖÖ³Æν¡£ ±¾Éè¼Æ²ÉÓõÄÊÇÔÚMyEclipse»·¾³ÏÂÒÔJava¿ª·¢ÑÔÓïΪºËÐÄËù±àдµÄÎå×ÓÆå¡£ÔÚÈË»ú¶ÔÞÄģʽÖУ¬µçÄÔÏÂÆåµÄËã·¨Ö÷Òª²ÉÓõÄÊÇËÑË÷Ëã·¨½áºÏ¹ÀÖµº¯ÊýÀ´Íê³ÉµçÄÔµÄÏÂÆå¡£ÔÚÁª»ú¶ÔÞÄģʽÖУ¬ÆåÅÌ״̬µÄ´«ÊäÓëͬ²½Ö÷ÒªÊÇͨ¹ýÆåÅÌÀàÓëmessageÀàµÄ½»»¥À´Íê³ÉµÄ£¬ÒÔ´ËÀ´ÊµÏÖÁª»ú¶ÔÞÄ¡£Æå¾ÖµÄʤ¸ºÊǸù¾Ý×îºóÒ»¸öÂä×ÓµÄÇé¿öÀ´Åжϵġ£ÐèÒª²é¿´Ëĸö·½Ïò£¬¼´ÒÔ¸ÃÆå×ÓΪ³ö·¢µãµÄˮƽ£¬ÊúÖ±ºÍÁ½Ìõ·Ö±ðΪ45 ¶È½ÇºÍ135 ¶È½ÇµÄÏߣ¬¿´ÔÚÕâËĸö·½ÏòÉϵÄÆäËüÆå×ÓÊÇ·ñÄܺÍ×îºóÂä×Ó¹¹³ÉÁ¬ÐøÎå¸öÆå×Ó£¬ÈôÓÐÁ¬³É5¸ö×ӵļ´ÎªÊ¤¡£ÔÙÅäÒÔUnixϵͳ¼°Servlet±êʶÓïÑÔ£¬×îÖÕÄܹ»ÊµÏÖ±¾»úÈË»ú¶ÔÞÄ£¬ÒÔ¼°Á½ÈËÁª»ú¶ÔÞÄ¡£ ¹Ø¼ü´Ê£ºÎå×ÓÆ壬ËÑË÷Ëã·¨£¬ÈË»ú¶ÔÞÄ£¬Áª»ú¶ÔÞÄ ABSTRACT Renju is one kind of the tradition Reversi which is originated in ancient China. Modern backgammon is named as "Pente" in Japanese, translated as "Renju", named as "Gobang" or "FIR" (Five in a Row acronym) in English, also have many. Other names, such as" Wu Lian Zi", "Wu Zi Lian", "bead" , "five head", "five head touch" and "five grid". This paper develop Cobang game by the language of Java in the MyEclipse environment. In the man-machine chess mode, the computer chess algorithm mainly uses search algorithm with valuation function. In the online chess mode, the transmission of checkerboard¡¯s transfer and synchronization is completed through the interaction of checkerboard and message, to realize online chess. The outcome of the chess game is based of the last piece¡¯s state. We should check four directions, namely, the level line, the vertical line, and the other two lines which have 45-degree angle and 135-degree angle with the starting point of the piece, and we should find whether the last piece can link with other pieces in the four directions to be five pieces in the line continuously. We will win if we connect the five pieces. Local man-machine chess and two on-line chess can be achieved coupling with Unix system and Setvlet markup language. Keywords: Gobang, search algorithms, human-machine chess, online chess Ŀ¼ ÕªÒªI ABSTRACTII µÚ1Õ ÒýÑÔ1 1.1 ±³¾°1 1.1.1 Îå×ÓÆåµÄ½éÉÜ1 1.1.2 ¿ÎÌâÑо¿µÄÒâÒå1 1.2 Ñо¿ÄÚÈÝ1 1.2.1 ¿ÎÌâÄ¿±êºÍÒªÇó1 1.2.2 ¿ª·¢»·¾³¼°ÔËÐл·¾³2 µÚ2Õ Îå×ÓÆåµÄ×ÜÌåÉè¼Æ3 2.1 Îå×ÓÆåÈí¼þµÄ×ÜÌå¼Ü¹¹Í¼3 2.2 ÓÎÏ·Ö÷½çÃæ4 2.3 ÆåÅÌÀà5 2.3.1 ÆåÅ̵ĻæÖÆ5 2.3.2 ÆåÅ̵ijõʼ»¯»æÖƼ°µ÷ÓÃ6 2.3.3 ÆåÅÌÊý¾ÝµÄ±£´æÓë×°ÔØ6 2.3.4 ÅжÏʤ¸º7 2.4 Ö÷ÒªÆåÅÌÏûÏ¢»úÖÆ7 2.4.1¡¡ÏûÏ¢»úÖƵļܹ¹7 2.4.2¡¡¸÷ÖÖÏûϢ˵Ã÷8 2.4.3¡¡Ä£Ê½µÄÑ¡Ôñ¡ª¡ªcptop¡¢cptoc8 2.4.4¡¡ÓÎÏ·µÄÍ˳ö¡ª¡ªquit9 2.4.5¡¡ÓÎÏ·µÄ°ïÖú¡ª¡ªabout9 2.4.6¡¡ÓÎÏ·µÄÉèÖ᪡ªsetting10 2.4.7¡¡Âä×ÓÏûÏ¢¡ª¡ªMSG_PUTSTEP10 2.4.8¡¡¿ª¾ÖÏûÏ¢¡ª¡ªMSG_PLAY10 2.4.9¡¡Í¬Ò⿪¾ÖÏûÏ¢¡ª¡ªMSG_AGREE11 2.5 ·þÎñÆ÷ ServerÀà11 2.6 ÓÎϷģʽÀà11 µÚ3Õ Îå×ÓÆåµÄ¾ßÌåÉè¼Æ13 3.1 ÆåÅÌÀࡪ¡ªBoardPanel13 3.1.1 Ö÷Òª³ÉÔ±±äÁ¿13 3.1.2 Ö÷Òª³ÉÔ±º¯Êý˵Ã÷14 3.2 ÓÎϷģʽÀà16 3.2.1¡¡Ö÷Òª³ÉÔ±±äÁ¿ËµÃ÷17 3.2.2 Ö÷Òª³ÉÔ±º¯Êý˵Ã÷17 µÚ4Õ µçÄÔÂä×Ó²ßÂÔÉè¼Æ20 4.1 ÅжÏʤ¸º20 4.2¡¡»ñʤ×éºÏ20 4.3¡¡Âä×Óºó´¦Àí21 4.4¡¡²éÕÒÆåÅÌ¿Õλ21 4.5¡¡·ÀÊزßÂÔ22 4.6¡¡Ñ¡È¡×î¼ÑÂä×Ó23 µÚ5Õ Áª»ú¶ÔÞĵÄʵÏÖ24 5.1¡¡·þÎñ¶Ë¹¦ÄܵÄʵÏÖ24 5.1.1 ·þÎñ¶ËµÄ¹¤×÷Á÷³Ì24 5.1.2 ·þÎñ¶Ë¹¤×÷Á÷³ÌµÄ´¦Àí25 5.2¡¡¿Í»§¶Ë¹¦ÄܵÄʵÏÖ25 µÚ6Õ ½áÂÛ26 ÖÂл27 ²Î¿¼ÎÄÏ×28 ¸½Â¼ Ô´´úÂë29
¾­¹ÜÖ®¼Ò¡°Ñ§µÀ»á¡±Ð¡³ÌÐò
  • ɨÂë¼ÓÈë¡°¿¼ÑÐѧϰ±Ê¼ÇȺ¡±
ÍƼöÔĶÁ
¾­¼ÃѧÏà¹ØÎÄÕÂ
±êÇ©ÔÆ
¾­¹ÜÖ®¼Ò¾«²ÊÎÄÕÂÍƼö