Craps赌博游戏
2014-10-20 19:05
369 查看
public class CrapsGame { public static int roll() { return (int) (Math.random() * 6 + 1); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int money = 10000; int ante = 0; int firstPoint, currentPoint; boolean sequel = true; do { boolean goon = false; firstPoint = currentPoint = roll() + roll(); System.out.print("你现在有" + money + "元,请下注:"); ante = sc.nextInt(); System.out.println("玩家摇出了: " + firstPoint + " 点"); switch (firstPoint) { case 7: case 11: System.out.println("玩家胜!!!"); money += ante; break; case 2: case 3: case 12: System.out.println("庄家胜!!!"); money -= ante; break; default: goon = true; break; } while (goon) { currentPoint = roll() + roll(); System.out.println("玩家摇出了: " + currentPoint + " 点"); if (currentPoint == 7) { System.out.println("玩家输"); money -= ante; goon = false; } else if (currentPoint == firstPoint) { System.out.println("玩家赢!!!"); money += ante; goon = false; } } System.out.println("现在有" + money + "元"); if (money <= 0) { System.out.println("你已经输完了,赌博结束!!!"); } else { System.out.println("是否继续?1,继续 2,不继续"); } int x = sc.nextInt(); if (x == 1) { sequel = true; } else { sequel = false; } } while (sequel); } }
相关文章推荐
- Python学习---综合练习之Craps赌博游戏
- craps赌博游戏
- Craps 赌博游戏
- Craps 赌博游戏 含押注
- craps赌博游戏
- 10 craps赌博游戏
- for if 语句初步运用实列赌博游戏可押注玩
- 利python写用赌博游戏函数版赏析:
- 挑战编程:抛硬币赌博游戏【转】
- 赌博游戏(C/python略)
- Grapse赌博游戏
- 大脑的「行为性」成瘾,如赌博、购物、游戏、工作、饮食和性等成瘾,与毒品、药物类成瘾有什么区别?心理上有什么区别?
- JAVA赌博游戏
- 第四届图灵杯A题 谷神的赌博游戏
- NOIP模拟 赌博游戏【概率dp】
- NOIP模拟(11.02)T4 赌博游戏
- 赌博游戏如何吸引人
- Java 两个骰子的 赌博游戏
- 抛硬币的赌博游戏——庞果英雄会
- 赌博游戏设计逻辑顺序题目