欢迎来到天天文库
浏览记录
ID:55631613
大小:28.00 KB
页数:6页
时间:2020-05-21
《java实现斗地主游戏.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、玩家类:packagecom.rh.lianxi;importjava.util.ArrayList;publicclassPlayer{privateStringname;privateStringscore;privateStringsex;privateArrayListlist;publicPlayer(Stringname,Stringscore,Stringsex){super();this.name=name;this.score=score;this.sex=sex;this.list=
2、list;}publicStringgetName(){returnname;}publicvoidsetName(Stringname){this.name=name;}publicStringgetScore(){returnscore;}publicvoidsetScore(Stringscore){this.score=score;}publicStringgetSex(){returnsex;}publicvoidsetSex(Stringsex){this.sex=sex;}publicArrayList<
3、String>getList(){returnlist;}publicvoidsetList(ArrayListlist){this.list=list;}}游戏:packagecom.rh.lianxi;importjava.util.ArrayList;importjava.util.Random;publicclassPokerGame{/**新牌*/publicstaticArrayListbuyPoker(){ArrayListpoker=newArrayLis
4、t();String[]color={"方片","草花","红桃","黑桃"};String[]value={"A","2","3","4","5","6","7","8","9","10","J","Q","K"};String[]wangpai={"大王","小王"};poker.add(wangpai[0]);poker.add(wangpai[1]);for(inti=0;i5、olor[i]+value[j]);}}returnpoker;}/**洗牌param:ArrayListpokerlist**@returnlist业务:如果这张牌已经存在了,不做处理;反之,将新牌添加进去注意:牌数=54张*/publicstaticArrayListwashPoker(ArrayListpokerlist){Randomrandom=newRandom();ArrayListlist=newArrayList();intcount=06、;while(count7、1---3(x-1)+3*/publicstaticObject[]groupPoker(ArrayListwashpokerlist){Object[]obj=newObject[4];ArrayListlist1=newArrayList();ArrayListlist2=newArrayList();ArrayListlist3=newArrayList();ArrayListlist48、=newArrayList();for(inti=1;i
5、olor[i]+value[j]);}}returnpoker;}/**洗牌param:ArrayListpokerlist**@returnlist业务:如果这张牌已经存在了,不做处理;反之,将新牌添加进去注意:牌数=54张*/publicstaticArrayListwashPoker(ArrayListpokerlist){Randomrandom=newRandom();ArrayListlist=newArrayList();intcount=0
6、;while(count7、1---3(x-1)+3*/publicstaticObject[]groupPoker(ArrayListwashpokerlist){Object[]obj=newObject[4];ArrayListlist1=newArrayList();ArrayListlist2=newArrayList();ArrayListlist3=newArrayList();ArrayListlist48、=newArrayList();for(inti=1;i
7、1---3(x-1)+3*/publicstaticObject[]groupPoker(ArrayListwashpokerlist){Object[]obj=newObject[4];ArrayListlist1=newArrayList();ArrayListlist2=newArrayList();ArrayListlist3=newArrayList();ArrayListlist4
8、=newArrayList();for(inti=1;i
此文档下载收益归作者所有