给我开发一个简单的cmd斗地主小游戏
时间: 2024-03-14 08:25:03 浏览: 21
好的,以下是一个简单的cmd斗地主小游戏的代码:
```python
import random
# 定义一副扑克牌
poker = ['A♠', '2♠', '3♠', '4♠', '5♠', '6♠', '7♠', '8♠', '9♠', '10♠', 'J♠', 'Q♠', 'K♠',
'A♥', '2♥', '3♥', '4♥', '5♥', '6♥', '7♥', '8♥', '9♥', '10♥', 'J♥', 'Q♥', 'K♥',
'A♣', '2♣', '3♣', '4♣', '5♣', '6♣', '7♣', '8♣', '9♣', '10♣', 'J♣', 'Q♣', 'K♣',
'A♦', '2♦', '3♦', '4♦', '5♦', '6♦', '7♦', '8♦', '9♦', '10♦', 'J♦', 'Q♦', 'K♦']
# 洗牌
random.shuffle(poker)
# 发牌
player1 = poker[:17]
player2 = poker[17:34]
player3 = poker[34:51]
landlord = poker[51:]
# 打印每个玩家的手牌
print('玩家1的手牌:', player1)
print('玩家2的手牌:', player2)
print('玩家3的手牌:', player3)
# 打印地主的手牌
print('地主的手牌:', landlord)
# 地主第一次出牌
print('地主开始出牌:')
landlord_play = input()
# 玩家1跟牌
print('玩家1跟牌:')
player1_play = input()
# 玩家2跟牌
print('玩家2跟牌:')
player2_play = input()
# 玩家3跟牌
print('玩家3跟牌:')
player3_play = input()
# 打印每个玩家出的牌
print('地主出牌:', landlord_play)
print('玩家1出牌:', player1_play)
print('玩家2出牌:', player2_play)
print('玩家3出牌:', player3_play)
```
这个小游戏只是一个简单的示例,可以根据需要进行修改和扩展。