牛元帅牛总管牛魔王开发

牛元帅牛总管游戏是流传于华南一带的民间游戏,在广东广西湖南地区尤为流行,2到5人玩,每位玩家发5张,相互比较大小。游戏用扑克52张,王除外,一起52张牌,玩家人数一般2到6个,每人发5张扑克


1,自由抢庄:每局开始玩家均可以选择是否抢庄,如果只有一个玩家抢庄,则抢庄玩家坐装,如果多人抢庄,则随机选择一名玩家坐庄,如果无人抢庄,则从所有中玩家随机一名玩家坐庄
2,牛牛上庄:第一局随机庄家,在玩家抓到牛牛之后,下一局会成为庄家,如果第一局有多个玩家牛牛,则牛牛最大的玩家成为庄家,如果无牛牛牌型,则本局增加下局连庄
3,固定庄家:房主固定庄家,在游戏中庄家不可变更,庄家可以拥有底分,在底分全部输完,在达到开房局数或者3局以后庄家主动下庄时结算,
4,明牌抢庄:玩家根据手中已亮开的四张牌决定抢庄或者不抢,抢庄倍数最大的玩家坐庄,如多名庄家选择最大倍数,则从中随机一名玩家坐庄,如无人抢庄,则从玩家中随机一名玩家坐庄
5,同比牛牛:无庄家,速度快,牌最大者赢全场
三国游网络科技专业定制开发牛元帅,牛总管,牛魔王,小吆牛牛,阿拉斗牛。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
好的,以下是一个简单的Java多线程程序,实现了魔王抖虱子大战孙悟空的场景。程序中使用了线程同步机制,保证了各个线程的安全性。代码如下: ```java public class Main { public static void main(String[] args) { // 初始化魔王、孙悟空和抖虱子 CowDemonKing cowDemonKing = new CowDemonKing("魔王", 1000, 100); SunWuKong sunWuKong = new SunWuKong("孙悟空", 800, 120); List<DouShuZi> douShuZiList = new ArrayList<>(); for (int i = 0; i < 10; i++) { douShuZiList.add(new DouShuZi("抖虱子" + (i + 1), 50, 20, cowDemonKing, sunWuKong)); } // 创建线程,每个线程代表一个抖虱子 List<Thread> threadList = new ArrayList<>(); for (int i = 0; i < 10; i++) { Thread thread = new Thread(douShuZiList.get(i)); threadList.add(thread); } // 开始战斗 for (Thread thread : threadList) { thread.start(); } // 等待所有线程结束 for (Thread thread : threadList) { try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } // 输出胜者 if (cowDemonKing.getHp() <= 0) { System.out.println("孙悟空胜利!"); } else if (sunWuKong.getHp() <= 0) { System.out.println("魔王胜利!"); } } } // 魔王类 class CowDemonKing { private String name; // 名称 private int hp; // 血量 private int attack; // 攻击力 public CowDemonKing(String name, int hp, int attack) { this.name = name; this.hp = hp; this.attack = attack; } // 受到攻击 public synchronized void beAttacked(int damage) { this.hp -= damage; if (this.hp <= 0) { this.hp = 0; } System.out.println(this.name + "受到了" + damage + "点伤害,剩余血量:" + this.hp); } public int getHp() { return hp; } public int getAttack() { return attack; } } // 孙悟空类 class SunWuKong { private String name; // 名称 private int hp; // 血量 private int attack; // 攻击力 public SunWuKong(String name, int hp, int attack) { this.name = name; this.hp = hp; this.attack = attack; } // 受到攻击 public synchronized void beAttacked(int damage) { this.hp -= damage; if (this.hp <= 0) { this.hp = 0; } System.out.println(this.name + "受到了" + damage + "点伤害,剩余血量:" + this.hp); } public int getHp() { return hp; } public int getAttack() { return attack; } } // 抖虱子类 class DouShuZi implements Runnable { private String name; // 名称 private int hp; // 血量 private int attack; // 攻击力 private CowDemonKing cowDemonKing; // 魔王 private SunWuKong sunWuKong; // 孙悟空 public DouShuZi(String name, int hp, int attack, CowDemonKing cowDemonKing, SunWuKong sunWuKong) { this.name = name; this.hp = hp; this.attack = attack; this.cowDemonKing = cowDemonKing; this.sunWuKong = sunWuKong; } // 攻击 private void attack() { int rand = (int) (Math.random() * 100); if (rand < 50) { // 攻击魔王 synchronized (cowDemonKing) { int damage = (int) (Math.random() * (attack + 10) + attack - 10); cowDemonKing.beAttacked(damage); } } else { // 攻击孙悟空 synchronized (sunWuKong) { int damage = (int) (Math.random() * (attack + 10) + attack - 10); sunWuKong.beAttacked(damage); } } } @Override public void run() { while (cowDemonKing.getHp() > 0 && sunWuKong.getHp() > 0 && hp > 0) { attack(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } } ``` 希望这个程序能够满足你的需求,如果有不足之处,请指出。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值