欢迎来到天天文库
浏览记录
ID:51909550
大小:40.00 KB
页数:3页
时间:2020-03-18
《java小游戏源代码.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、Java小游戏第一个Java文件:importjava.util.Scanner;publicclassGameA_B{publicstaticvoidmain(String[]args){Scannerreader=newScanner(System.in);intarea;System.out.println("GameStart…………Pleaseenterthearea:(1-9)"+''+"1,2,3meanseasy"+''+"4,5,6meansmiddle"+''+"
2、7,8,9meanshard"+''+"Pleasechoose:");area=reader.nextInt();switch((area-1)/3){case0:System.out.println("Youchooseeasy!");break;case1:System.out.println("Youchoosemiddle!");break;case2:System.out.println("Youchoosehard!");break;}System.out.println("G
3、oodLuck!");GameProcessgame1=newGameProcess(area);game1.process();}}第二个Java文件:importjava.util.Random;importjava.util.Scanner;publicclassGameProcess{intarea,i,arrcount,right,midright,t;intbase[]=newint[arrcount],userNum[]=newint[area],sysNum[]=newint[a
4、rea];Randomrandom=newRandom();Scannerreader=newScanner(System.in);GameProcess(inta){area=a;arrcount=10;right=0;midright=0;t=0;base=newint[arrcount];userNum=newint[area];sysNum=newint[area];for(inti=0;i5、e[i]);}}voidprocess(){rand();while(right!=area){scanf();compare();print();check();}}voidrand(){for(i=0;i6、t;j7、in…………!");}booleancheck(inti){returntrue;}voidcompare(){inti=0,j=0;right=midright=0;for(i=0;i
5、e[i]);}}voidprocess(){rand();while(right!=area){scanf();compare();print();check();}}voidrand(){for(i=0;i
6、t;j7、in…………!");}booleancheck(inti){returntrue;}voidcompare(){inti=0,j=0;right=midright=0;for(i=0;i
7、in…………!");}booleancheck(inti){returntrue;}voidcompare(){inti=0,j=0;right=midright=0;for(i=0;i
此文档下载收益归作者所有