本人来到黑马也有一段学习的时间了,刚刚通过就业班的考试,进入了就业班,通过这几天的学习,感觉也学到了不少.学习这东西的开始是纯粹因为喜欢,网传的黑客老哥,无敌的操作电脑的技术.是小时候的梦想,现在学了几天了,毕竟还是自己做出一点点东西,才有那种弱弱的成就感. 下边呢是我,自己做的一个模拟阴阳师抽奖的小代码,由于个人挺喜欢这个游戏,所以就试着写了写,如果有大神看到的,有错请指教一下,不喜勿喷. 代码:package wozijizuodeyinyangshi;
import java.util.ArrayList;
import java.util.Random;
public class choujiangku {
public void danchou(){
String[] SSR = {"SSR:面灵气","SSR:山风","SSR:御馔津","SSR:玉藻前","SSR:雪童子","SSR:彼岸花",
"SSR:荒","SSR:辉夜姬","SSR:大天狗","SSR:鬼切", "SSR:荒川之主","SSR:茨木童子",
"SSR:妖刀姬","SSR:酒吞童子","SSR:阎魔","SSR:小鹿男","SSR:青行灯","SSR:花鸟卷","SSR:一目连"};
Random a = new Random();
int a1 = a.nextInt(SSR.length);
String[] SR = {"SR:猫掌柜","SR:薰","SR:奕","SR:日和坊","SR:追月神","SR:百目鬼","SR:书翁","SR:小松丸"
,"SR:匣中少女","SR:以津真天", "SR:鸩","SR:金鱼姬","SR:烟烟罗","SR:桃花妖","SR:鬼使白","SR:孟婆"
,"SR:骨女","SR:跳跳哥哥","SR:海坊主","SR:雪女", "SR:鬼使黑","SR:犬神","SR:鬼女红叶","SR:傀儡师"
,"SR:判官","SR:凤凰火","SR:妖狐","SR:食梦貘","SR:镰鼬","SR:二口女","SR:樱花妖","SR:吸血姬",
"SR:妖琴师","SR:清姬","SR:姑获鸟","SR:白狼","SR:惠比寿","SR:黑童子","SR:白童子","SR:夜叉"
,"SR:青坊主","SR:络新妇","SR:般若","SR:於菊虫"};
Random b = new Random();
String[] R = {"R:虫师","R:兔丸","R:三尾狐","R:鲤鱼精","R:狸猫","R:童男","R:饿鬼","R:鸦天狗","R:座敷童子"
,"R:九命猫","R:河童","R:童女","R:巫蛊师","R:食发鬼","R:武士之灵","R:跳跳弟弟","R:兵俑","R:独眼小僧"
,"R:椒图","R:山兔","R:雨女", "R:跳跳妹妹","R:丑时之女","R:铁鼠","R:管狐","R:萤草","R:蝴蝶精",
"R:首无","R:青蛙瓷器","R:山童","R:觉","R:古笼火"};
Random c = new Random();
Random random = new Random();
ArrayList<String> arr = new ArrayList<>();
arr.add(SSR[a1]);
for (int i = 0; i < 34; i++) {
int b1 = b.nextInt(SR.length);
arr.add(SR[b1]);
}
for (int i = 0; i < 65; i++) {
int c1 = c.nextInt(R.length);
arr.add(R[c1]);
}
int i = random.nextInt(99);
System.out.print(arr.get(i)+" ");
}
}
package wozijizuodeyinyangshi;
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;
public class YYS {
public static void main(String[] args) {
choujiangku chou =
new choujiangku();
Scanner scanner =
new Scanner(System.
in);
int cishu =
0;
while(
true){
System.
out.println();
System.
out.println(
"请选择抽奖的类型:(1:单抽(18块),10:十连抽(128块),0退出)");
int s = scanner.nextInt();
switch(s){
case 1:
chou.danchou();
cishu++;
break;
case 10:
for (
int i =
0; i <
10; i++) {
chou.danchou();
cishu++;
}
break;
case 0 :
System.
out.println(
"累计次数为:"+cishu);
return;
}
}
}
}
上边就是两个文件的代码了
.致敬,最最喜欢的痒痒鼠!!!!!!!!!!下面 送出一波欧气!!!!!!!!!