欢迎来到天天文库
浏览记录
ID:39341386
大小:15.95 KB
页数:6页
时间:2019-07-01
《java实现斗地主游戏》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
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=list;}publicStringgetName(){retur
2、nname;}publicvoidsetName(Stringname){this.name=name;}publicStringgetScore(){returnscore;}publicvoidsetScore(Stringscore){this.score=score;}publicStringgetSex(){returnsex;}publicvoidsetSex(Stringsex){this.sex=sex;}publicArrayListgetList(){returnlist;}publicvoidsetList(ArrayListli
3、st){this.list=list;}}游戏:packagecom.rh.lianxi;importjava.util.ArrayList;importjava.util.Random;publicclassPokerGame{/**新牌*/publicstaticArrayListbuyPoker(){ArrayListpoker=newArrayList();String[]color={"方片","草花","红桃","黑桃"};String[]value={"A","2","3","4","5","6","7","8","9",
4、"10","J","Q","K"};String[]wangpai={"大王","小王"};poker.add(wangpai[0]);poker.add(wangpai[1]);for(inti=0;i5、ListwashPoker(ArrayListpokerlist){Randomrandom=newRandom();ArrayListlist=newArrayList();intcount=0;while(count6、牌param:洗好的牌return:3副牌和底牌=obj[]第一个人是拿的1,4,7,10---3(x-1)+1*第二个人是拿的2,5,8,11---3(x-1)+2第三个人是拿的2,5,8,11---3(x-1)+3*/publicstaticObject[]groupPoker(ArrayListwashpokerlist){Object[]obj=newObject[4];ArrayListlist1=newArrayList();ArrayListlist2=newArrayList();Arra7、yListlist3=newArrayList();ArrayListlist4=newArrayList();for(inti=1;i
5、ListwashPoker(ArrayListpokerlist){Randomrandom=newRandom();ArrayListlist=newArrayList();intcount=0;while(count6、牌param:洗好的牌return:3副牌和底牌=obj[]第一个人是拿的1,4,7,10---3(x-1)+1*第二个人是拿的2,5,8,11---3(x-1)+2第三个人是拿的2,5,8,11---3(x-1)+3*/publicstaticObject[]groupPoker(ArrayListwashpokerlist){Object[]obj=newObject[4];ArrayListlist1=newArrayList();ArrayListlist2=newArrayList();Arra7、yListlist3=newArrayList();ArrayListlist4=newArrayList();for(inti=1;i
6、牌param:洗好的牌return:3副牌和底牌=obj[]第一个人是拿的1,4,7,10---3(x-1)+1*第二个人是拿的2,5,8,11---3(x-1)+2第三个人是拿的2,5,8,11---3(x-1)+3*/publicstaticObject[]groupPoker(ArrayListwashpokerlist){Object[]obj=newObject[4];ArrayListlist1=newArrayList();ArrayListlist2=newArrayList();Arra
7、yListlist3=newArrayList();ArrayListlist4=newArrayList();for(inti=1;i
此文档下载收益归作者所有