return (int) (Math.random() * 6 + 1);
}
public static void main(String[] args) {
int firstPoint, currentPoint;
firstPoint = currentPoint = roll() + roll();
System.out.println("玩家摇出了" + currentPoint + "点");
boolean goon = false;
switch(currentPoint) {
case 7: case 11:
System.out.println("玩家胜!!!");
break;
case 2: case 3: case 12:
System.out.println("庄家胜!!!");
break;
default:
goon = true;
}
while(goon) {
currentPoint = roll() + roll();
System.out.println("玩家摇出了" + currentPoint + "点");
if(currentPoint == 7) {
System.out.println("庄家胜!!!");
goon = false;
}
else if(currentPoint == firstPoint) {
System.out.println("玩家胜!!!");
goon = false;
}
}
}
}
赌博游戏
最新推荐文章于 2024-03-23 15:09:01 发布