.;lassTestStartGuess{/***人机互动版豁拳游戏*步伐入口*/publicstaticvoidmain(String[]args){Gamegame=newGame();();();}}2..;;/***用户类*阶段1完成****@param*/lassPerson{Stringname="匿名";//名字intscore=0;//积分/***出拳****@return出拳结果:*/publicintshowFist(){//吸收用户的选择Scannerinput=newScanner();("\n请出拳:(输入相应数字):");intshow=();//输出出拳结果,并返回switch(show){case1:("你出拳:铰剪");break;case2:("你出拳:石头");break;case3:("你出拳:布");break;}returnshow;}}.;/***盘算机类*阶段2完成*/puter{Stringname="电脑";//名字intscore=0;;//积分/***出拳****@return出拳结果:*/publicintshowFist(){//产生随机数intshow=(int)(()*10)%3+1;//产生随机数,体现电脑出拳//输出出拳结果并返回switch(show){case1:(name+"你出拳:铰剪");break;case2:(name+"你出拳:石头");break;case3:(name+"你出拳:布");break;}returnshow;}}4..;;/***游戏类类完全版*阶段7:成果扩展****@puter>**/puter>{Personperson;//puter;//乙方intcount;//对战次数/***初始化*/publicvoidinitial(){person=newPerson();computer=puter();count=0;}/***开始游戏*/***@SuppressWarnings("resource")publicvoidstartGame(){("-------欢迎进入游戏世界-------\n");("\n\t\t***************");("\t\t**豁拳,开始**");("\t\t***************");("\n\n出拳规矩:,,")
人机猜拳思路 来自beplayapp体育下载www.apt-nc.com转载请标明出处.