




已阅读5页,还剩7页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
0外文原文AlgorithmDesignonNetworkGameofChineseChessThispaperdescribesthecurrentsituationofdomesticnetworkgame.Contactthenetworkgamecurrently,weinquiredtofacetoamultithreadtcpclientandserver,suchasChinesechess,accordingtotheinformation,andstudythecontentsandmeanings.CombiningtheJavaofbasicknowledge,thearticlestudythecompilingprocedurefacingtotheobjectaccordingtotheinformationinJavaSwingusage,andthemethodofthenetworkprocedure.ThearticleresearchedthemethodandprocessesofthenetworkprocedurecarryontheuseofsprocketundertheJavaSwing.UnderstoodthebasicprocessofcompilingprocedureusingJavaandhowtocompileanetworkprocedure.ThemostimportanceishowapairofmachinescorrespondenceC/Stheservicesystemiscarriedout.Fromhere,weputforwardthedatastructure,thebasiccalculatewayofthenetworkgameChinesechess,andhowtodesignandrealizetheserverandclientofthatprocedure.Theonlinegameschessdesigncanbedividedintoseveralmodulesasfollows:servermodule,clientmoduleandthecontrolmodule.AstheInternethasimprovedsteadily,Javaprogramminginthegamegraduallyrevealedthepowerfulfeatures,particularlyitsrobustnessandcrossplatformtypeanditsapplicationsinthenetworkthepowerisusedtomakevarioustypesofgamedevelopment.SuchasmobilephonegamesbasedonJ2ME,JavaAppletorJavaSwingbasedmultimediagames,onlinegamesbasedonJ2EEarchitecture,etc.2.ThedesignisbasedonC/StoachieveasimpledoubleplaychessNetworkChineseChessapplication.Thegameusestheeclipsedevelopmenttools.Thechessgameoffersnetworksupport,LANnetworkinginthegame,thechessgameontheothertwoplayersnotinthestate,butratheroneofprovidingservicestoanotherperson;butthechessgametosettheserverandclientinone,thatis,eitherthesameapplicationcanalsochoosetoselectaserverasaclient.Andthatthechesssetalsohasthefunctionofthrowinginthetowelandbackground3.Specificuseasfollows:Serverside:OpenApplicationsStarttheserverClient:OpenApplicationsLinkentertheserverIPaddress1Thentherewillbeapawntoplayagainstcanbe.Thisgamecanalsochangethebackground.Youcanhavetheimagefilesinthecomputerchooseyourfavoritepictures.ThisarticlebasedonthedesignandimplementationofaC/Sserviceroutinedoubleplaychessgames,userscanInternet,andotheronlineusersinbattle.ThesystemisbuiltonWindowsXPplatform,usingtheEclipseofthedevelopmenttools.Althoughthisdesignisagame,butitisourunderstandingofJavaprogramminglanguageanditsConcretehasanimportantrole.BecauseitinvolvesnotonlytheJavaSwing,alsoinvolvesanetworkofKnowledgeTcpSocket,involvingaverywiderangeofcontent,butalsoconducivetotheunderstandinganduseofJavaprogramming.Onlinegameserviceprogramdesignedconsidermanydetailsoftheproblem,howtodesignsimpleandclearisaneedtostudyoftheproblem.Thedesignisbasedonmessageresponsemechanismandobjectorienteddesignofserviceprograms,sothattheserverandclientprogrammingsimpleandclear,andtheimplementationdetailsofeachpackagetoachievetheobjectinside,objectimplementsitsownspecificfeatures.Simplestructureofthewholesystem,serverandclienttoachieveamoregenericprogrammodel.Theclientserverarchitecture,theserverusuallyinapassivestate,waitingforvariousrequestsofcustomers,andtheserveristriggeredbythemessageandmessageresponsemechanismtocompleteitswork.Sohowtoproperlydesignthearchitectureofserversideprogramstomeettheneedsoftheapplicationisparticularlyimportant.Inourdesignthestructureoftheserviceprogram,focusingontheclienttoconsidertheserverresponsemessage,andtorespondtoarequestsubmittedtooperateaparticularobject,thesystemarchitectureratherclearandeasytoexpand.IntheTCP/IPnetworkcommunicationsbetweentwoprocessesisthemainmodeofinteractionbetweenclient/servermode(Client/Servermodel),thecustomerservicerequesttotheserver,theserverreceivestherequest,provideappropriateservices.Client/servermodelbuildsonthefollowingtwopoints:first,toestablishthecauseofthenetworkisthenetworkhardwareandsoftwareresources,computingpowerandinformationinequality,needtoshare,thusbringingthetotalnumberofresourceswiththehosttoprovideservicestocustomerswithfewerresourcesrequestserviceroleofthenonreciprocal.Secondly,theinterconnectionprocesscommunicationiscompletelyasynchronous,interprocesscommunicationbetweenparentchildrelationshipdoesnotexistand,withoutsharedmemorycache,requiringamechanismforthewishtoestablish2communicationbetweenprocessestoestablishcontactsfordataexchangebetweenthetwoprovidessynchronization,whichisbasedonclient/serverTCP/IP.Client/servermodeladoptedduringtheoperationmodeisanactiverequest.serversidefirststart,and,uponrequest,providethecorrespondingservice.Opencommunicationchannelsandinformthelocalhost,itiswillingtoaddressinarecognizedreceivingclientrequests.waitingforclientrequestsarriveattheport.receivecustomerservicerequests,processtherequestandsendsresponsesignals.ReceiveandsendservicerequeststoActivationofanewprocesstohandlethecustomerrequest.Dealwiththisnewprocesscustomerrequestsanddonotneedtomakeresponsetootherrequests.Serviceiscompleted,closethenewprocessofcommunicationlinkswithcustomersandend.backtoStep2andwaitforanothercustomerrequest.shutdowntheserver.Clientsideimplementationisasfollows.opencommunicationchannels,andconnecttotheserverwherethehostspecificport.servicerequeststothemessagesentbytheserver,waitforandreceivearesponse;continuewiththerequest.Aftertheclosethecommunicationchannelrequestandterminated.Wecanseefromtheabovedescription:theroleofclientandserverprocessnonreciprocal,soencodingdifferent.ServerprocessGeneralrealizationofhandlingcustomerrequestsinitiated.Aslongasthesystemisrunning,theserviceprocess,therehasbeen,untilthenormalorforcedtermination.Serverprogramusuallylisteninawellknownaddressoftherequestforservices,thatprocesshasbeeninadormantstateuntilacustomersaddressfortheservicemadetheconnectionrequest.Atthismoment,theserviceprogramiswakeupandprovideservicesforcustomersthecustomersrequesttomakeanappropriateresponse.GameinterfaceusingJavaSwingAPIfunctionimplementation,inthedesignoftheChinesechessboardasacoordinatesystemtothelowerleftcornerfortheoriginofcoordinates,theboardoftherowsandcolumnsarethexaxiscoordinatesystemandtheyaxistotheboardoncoordinatesofeachsmallcell,asaunit,theboardweredrawn3horizontal,vertical,tipsonbothsidesoftheboardcoordinates,generalszoneandrivercommunity.Inprogramming,thefirstofallpiecesarenumbered,theboardisshapingthecontentoftwodimensionalarraytomarkthearraysubscriptthattheboardposition(coordinates),ifthecurrentpositionofthepiecesonthevalueofthearrayelementThenumberofpieces,and0otherwise.Arraylengthis90(Chinesechesscrosscuttingatotalof910points).Modifythecontentsofthearrayeverystep,whilethecontentsofthearraytotheBoardrepaintingsurface.Linkedbyanumberofobjects,callednodesofadatastructure,data,andeachnodecontainsareferencetotheobjectthenextnode(singlelist),orcontainsadataobjectcontainsareferencetothepreviousnodeandthenextNodeobjectreference(doublylinkedlist).Thechessgameistousetheformtorecordlist.First,createalinkedlist,andthenusetheadd()methodtoaddnodeschess,chessrecordseverystep,andfinallystoredinthefile.Readthedata,accordingtotheorderlisttoreadchess.Thechessgamerequiresalotofbitmaps,suchasthedialogbackground,thechessboardandchesspiecesareallusedtoactasabitmap.Itisnecessarytoimporttherequiredbitmap.Inaddition,thechessgamealsocanreplacethebackgroundcolor,thecodeisasfollows:if(evt.arg.equals(ChessArray.menu10i)(ChessArray.img=Toolkit.getDefaultToolkit().GetImage(checkerboardpattern+ChessArray.menu10i+.Jpg);ChessArray.repaint=true;ChessArmation(imagehasbeenloaded;+ChessArmation);returntrue;)if(evt.arg.equals(Other.)(StringSbak=ChessArmation;ChessArmation(OpenFiledialogboxis,pleasewait.);FileDialogfl=newFileDialog(newFrame(),selectthecheckerboardpattern,0);fl.setBounds(width/4,this.height/6,width/2,height/3);fl.show();ChessArmation(Pleaseselectyourdesiredpattern);4ChessArray.img=Toolkit.getDefaultToolkit().GetImage(fl.getDirectory()+fl.getFile();ChessArray.repaint=true;ChessArmation(imagehasbeenloaded+Sbak);returntrue;)First,theboardintoabitmapformatoftheboardshowninFigure34.(IncludingpaintingofmwordboxatthecalledNinepalace.)BoardstructureisatwodimensionalarraychArray109.Firstontheboardinitialization,theinitialarrayofzerochArray109=0.Theninitializethepieces,whichpiecesintheboardpositioncorrespondinglabel:Black:chArray00=chArray08=1;chArray01=chArray07=2;chArray02=chArray06=4;chArray03=chArray05=5;chArray04=6;/willbechArray21=chArray27=3;chArray30=chArray32=chArray34=chArray36=chArray38=7;HongQi:chArray60=chArray62=chArray64=chArray66=chArray68=7;chArray71=chArray73=3;chArray90=chArray98=1;chArray91=chArray97=2;chArray92=chArray96=4;chArray93=chArray95=5;chArray94=6;Thegame,bythepartytogofirstredroles,eachtakingaturnwithbothsides,untiltheseparationofwin,loss,and,gameTheend.Turntoturntomovethepartytoapiecefromoneintersectiontoanotherintersection,oreatingeachotherspiecesandtheoccupationoftheirintersection,areconsideredasignificantwalk.Withachsidetakingacalledaround.5Whenonesideattackstheotherhandsomepieces(tobe),andamusteatitinthenext,knownasaccordingtoorsimplywill.Accordingtothedonothavetodeclare.Beaccordingtothepartymustimmediatelyshould,thatisthelawwiththeirowntoresolveiswillstate.Ifitis,accordingtoandnotshould,evenifistodie9.variouspiecesofthemovesShuai(tobe):Shuaiandwillbetheheadofchess,thegoalisthatbothsidesstrivetocompete.Theycanonlygoanyway,andcannotOutoftheninepalacesoutside.Shi(Shi):Shi(Shi)isahandsomebodyguard,itcanonlymoveinninepalace.ItcanonlybealineofchesspathNineintrauterineslash.Phase(as):phase(as)themainroleisdefense,toprotecttheircommander(tobe).ItisthewalkthroughontheangleeverytimeTakethetwocelllines,commonlyknownaslikewalkingfields.Cars:themostpowerfulcarinchess,whetherhorizontal,verticalcanwalk,aslongasnochildblock,thenumberofstepsisnotlimited.Therefore,acarcancontrol17points.Guns:gunsinthewalkandwhenchildrendonoteatexactlythesamecar.However,ifyouwanttoeatthechild,betweenthechildeatitMustbeseparatedandonlyapawn.CommonlyknownasgunrackorgunfightGezi.Malaysia:Malaysiahasbeenmovingwayisaramp,whichistogostraightsideways,oragrid,andthengosidewaysadiagonalCommonlyknownashorsetogoon.Soldiers(soldier):Soldiers(death)ofthelineofchessrulesofchessinChinaisthemostcomplex.Bing(death)intothelinechessrulesTwosituations:oneisthepiecedidnotcrosstheriverboundary;theotherisacrosstheriverborderpieces.Sothesoldiers(anddeath)ofthelinechessalgorithmtodeterminewhenthefirstdidnotcrosstheriverintheworld.Inaddition,thesoldiers(anddeatcanonlymoveonegrid,andthesoldiers(anddeath)cannotturnback.Asthedesignisonlinegames,isbasedontheclientservermodel,sothemostimportantthingishowtomasteroffthecommunicationbetweenservers,thatdoublemachinecommunication.ThisprogramusestoachievedoubleSocketsocketcommunication.Thissectioncontainstwo:ServerClientblocksandblocks,oneforeachthread.InthedesigncorrespondstotheChessServerclassandChessClientclass.WhenyouclickthemenuGameitem,startthegame.WhenyouselectIdentitybanker,the6useofaServerblock,waitingfortheothersideoftheconnection;WhenyouclickthemenuchoiceofidentityChallengeritem,theuseofaClientblock,withinconnectiontheotherparty.ServersideandclientsideTCPsocketconnectionisusedandthenetworkconnectiontoachieve,buttheserversideandclientsidecanbegoodcommunication,municationdatastructureServerandclientcommunicateusingthespecificdatastructureforcommunication,firstneedtodefineadatastructuretypes.AndstoredinChessArrayclass.Filethestatementaredefinedasfollows:publicstaticbooleansORc;publicstaticbooleancountOR;publicstaticbooleanreadyIn=false;publicstaticbooleanreadyOut=false;publicstaticbooleanchange=false;publicstaticbooleannetChange=false;thecommunicationprocessServerandclienttobeabletocommunicatewellandbeabletorespondtoeachothersrequest,theserverandclientmusthaveacompletesetofprotocols.Inthisway,theserversideandclientsidetotheotherpersonsrequest,andmaketheappropriateaction.Serveridentifiestheclientcommandsare:userrequestaconnectionrequest,theuserrequiredtowithdrawtherequestandsoon.Servercansendamessagetotheclientare:serverdownmessage,theserveropensthemessage,theusersmovenews.Thisgameisbasedontheservermodule,clientmoduleandcontrolmoduleisinthedesignview,whichwereusedinsomeoftheknowledgeofnetworkprogramming,mainlyintheuseoftheJavaSocketprogramming.Thedesignofthemostimportantarethefollowing:chessoveralldatastructure,includinghowtorepresenttheboardandchess.ThisdesignisatwodimensionalarraySaid.Communication:Asthedesignisbasedonthenetwork,whichisonlineplay,sothecommunicationbetweentwocomputers,especially7Important.Thisincludesserverandclientintwoparts.Serverisusedtoestablishconnectionsanddealwithvariousrequests.Thekeyistorequesttheclienttosendcommandstoconnectandmakesomejudgments.Inthedevelopmentprocess,encounteredsomedifficulties.Forexample:serverandclientcommunicationproblemsbetweenitsthreadsSynchronizationproblems.Toaddresstheseissues,theintroductionofthekeywordsynchronizedtosolvethesynchronizationproblemofdatacorruptionoccur.Istousethesynchronizedmodifier,indicatingthattheobjectatanytimeonlyonethreadaccess;Whenathreadenterssynchronizedmethod,toensureaccesstothisinanywayotherthreadstocompletetheirimplementation;ifathreadtriestoaccessanAlreadystartedthesynchronizedmethod,thenthethreadmustwaituntilthethreadhasbeenstartediscompleted,thereleaseofthesynchronizedmethod.Thus,tosolvetheabovetwoissues.Makesthedesigncanproceedsmoothly.8中文翻译算法设计网络中国象棋游戏该论文描述现状国内网络游戏。接触现状当地网络游戏目前,我们问脸一个多流tcp客户机和服务器,等中国象棋信息,研究内容和含义。结合Java基本知识,文章学习编译过程面临对象显示信息JavaSwing用法,并方法网络过程。文章研究方法和过程网络过程背使用链轮JavaSwing。理解基本过程编译过程使用Java和如何编译网络过程。最重要性是一双机器correspondence-C/S服务场系统出来。从这里,我们数据结构基本计算方式网络游戏中国国际象棋,如何设计和实现服务器和端过程。在线游戏象棋设计可以分为几个模块遵循:服务器模块,端模块和控制模块2011年发布的爱思唯尔有限公司选择和/或同行审查下责任名字组织者关键词:java;多流;中国象棋;沟通随着互联网稳步改善,Java编程游戏逐渐透露强大特性,尤其是健壮性和交叉平台类型及其应用网络权力使用使各种游戏发展。等移动电话游戏基于J2ME,JavaApplet或基于JavaSwing多媒体游戏,在线游戏基于J2EE架构,等等。设计基于C/S实现简单玩象棋网络中国象棋应用。游戏使用eclipse开发工具。象棋游戏提供网络支持,局域网网络游戏,象棋游戏其他两球员不是状态,而是之一提供服务另一个人;但象棋游戏设置服务器和客户,要么应用相同也选择选择服务器客户机。和象棋集也投掷的函数吗毛巾和背3。特定使用:服务器:开放应用启动服务器客户:开放应用链接进入服务器IP地址然后将走卒玩可以。这游戏也背景变化。你有形象文件电脑选择最喜欢图片。吗本文基于设计和实现C/S服务常规双象棋游戏,互联网用户,在线和其他用户战斗。系统WindowsXP平台上建立,使用eclipse发展工具。尽管设计游戏,但我们理解Java编程语言及其混凝土重要作用。因为不仅仅涉及Java秋千,也涉及网络知识TcpSocket,涉及非常范围宽内容,还有利理解使用Java编程。在线游戏服务程序设计考虑许多细节问题,如何设计简单和清楚需要研究问题。设计基于消息响应和机制服务对象面设计程序服务器和端编程简单和清晰,实现细节每个包实现对象里面,对象实现自己特定特性。结构简单整个系统,服务器和端实现更通用程序模型客户机服务器架构,服务器通常被动状态,等待各种的请求客户、和服务器触发消息和消息响应机制完整工作。所以正常设计服务器的架构一边程序满需要应用程序尤其是重要。在我们设计结构服务计划,关注客户机考虑服务器响应消息,和回应请求提交运营特定对象,而系统体系结构清晰的和容易扩大在TCP/IP网络通两过程主要模式交互客户机/服务器之间模式(客户机/服务器模型),客户服务请求服务器服务器收到请求,提供适当服务。客户机/服务器模型构建后两点:首先,建立原因的网络网络硬件和软件资源,计算和信息不平等,需份额,因此将总资源主机提供服务客户少资源请求服务角非互惠。其次,互连过程通信完全异步,国米通信过程父母子女之间关系不存在,没有共享内存缓存,要求机制对于希望建立进程之间的通信建立联系人数据交换之间两提供同步,哪个基于客户机/服务器TCP/IP。客户端/服务器模型操作期间采用模式活跃请求。9服务器端第一开始,请求,提供相应服务。开放沟通渠道和通知本地主机,它愿意地址公认客户端接收请求。等待客户机请求来到端口收到客户服务请求,过程请求和发送响应信号。接收和发送服务请求活化新过程处理客请求。处理这新客户过程请求和不需要使响应其他请求。服务完成,密切新的过程与客户沟通链接结束回到一步2等待另一个客户请求。关闭服务器客户机端实现遵循。开放沟通渠道,和连服务器主机特定港口服务请求服务器,发送消息等待接收响应;继续请求。关闭后通信通道请求和终止。我们看到上面描述:角客户和服务器非互惠的过程,编码不同服务器过程一般实现处理客户发起的请求。一样长系统运行,服务过程,一直直到正常或迫使终止。服务器程序通常听井已知解决请求服务过程一直休眠状态直到客户地址服务连接请求。这一刻,服务程序叫醒和客户提供服务客户请求使适当的响应。节关注那些用于用户接口。游戏使用JavaSwingAPI接口功能实现,在设计中国象棋董事会坐标系统低离开角落起源坐标,董事会行和列x轴协调系统和y轴上董事会坐标每个细胞小,单元,董事会吸引水平,垂直,技巧两董事会坐标,将军区和河社区。编程,首先所有碎片编号,董事会塑造两维数组的内马克数组下标,董事会位置(坐标),如果当前位置块在价值数组元素件数量,和0否则数组长度90(中国象棋交叉削减总910分)。修改内容的数组每个一步,虽然内容数组董事会再保险绘画表面有关号码对象,称为节点数据结构,数据,和每个节点包含参考对象接下来节点(单列表),或包含数据对象包含引用以前节点和下节点对象引用(双重链接列表)。象棋游戏使用形式列表记录。首先,创建联系列表,然后使用添加()方法添加节点象棋,象棋每个记录最后一步,和存储在文件。读取数据,显示秩序列表读象棋。象棋游戏需要很多位图,对话框等背景,国际象棋董事会和象棋块所有使用行为位图。它必要进口所需位图。象棋游戏也取代背景颜色,代码是:(evt.arg.equals(ChessArray.menu10我)(ChessArray。img=工具包。getDefaultToolkit()。GetImage(“棋盘模式”+ChessArray.menu10我+”。Jpg”);Ch
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 农副食品全产业链可持续发展创新创业项目商业计划书
- 移动互联网创新创业项目商业计划书
- 农村基础施工打桩方案(3篇)
- 高原项目管理措施方案(3篇)
- 景观连廊拆除方案(3篇)
- Module4Unit1课件外研版英语八年级下册
- 2025-2030年中国新能源汽车产业大数据分析及发展前景预测研究报告
- 2025-2030年中国人工智能大模型产业现状调查及未来趋势研判报告
- 2025年事业单位工勤技能-山西-山西水工监测工二级(技师)历年参考题库含答案解析(5套)
- 冷藏饮品品类规划方案(3篇)
- 社区卫生服务中心基孔肯雅热发热-门诊应急处置预案
- 2025关于医疗平台与医疗机构合作合同模板
- 2025学校食堂档口承包合同
- 福州工会考试试题及答案
- 2025年“质量月”全面质量管理知识竞赛考试题(附答案)
- 2025年汽车驾驶员(技师)考试试题及答案(含答案)
- 学校后勤工作管理培训
- 胰腺炎的营养治疗与护理
- 江西省上饶市2024-2025学年七年级下学期期末语文试题
- 2025年小学生环保科普知识竞赛题库及答案
- 2025至2030年中国乙醇行业市场全景调研及发展趋向研判报告
评论
0/150
提交评论