新人求教:Python掷骰子小游戏编程

各位达人:新人求教,跪求一个Python编程的小游戏,具体内容如下,跪拜叩首感谢!
421骰子游戏规则(Python编程)
1. 421骰子游戏是一个在欧洲国家非常流行的酒吧以及家庭娱乐游戏。
模拟4个玩家;三个骰子,二十一个筹码
2. 如何玩421骰子游戏:
开局,玩法,输赢:(每次游戏,所有的可议定的游戏规则必须在由玩家们在开局之前议定。)
A. 如何开始:
要开始421骰子游戏,必须决定谁先开局,即哪个玩家先开始掷骰子。两个玩家可以先开始掷一个骰子,谁的分数最低,谁开局;也可以是谁的分数最高,谁开局,此规则可以在游戏开始时议定。 然后,每个玩家轮流掷骰子,按顺时针方向。
B. 开局,开始掷三个骰子。
421骰子游戏一般有两局,第一局抢筹码;第二局派光筹码。全部筹码叫做筹码池。第一局抢筹码:谁得到最多筹码,谁赢。在游戏第一局叫“担子”,玩家分配筹码,并且尽可能赢回筹码。每个玩家掷一次骰子,按顺时针方向轮流,直到五轮,第一局结束。
C. 输赢
第二局,开局,第一局谁赢了,谁开局。在游戏第二局叫“分流”,玩家尽可能将筹码用完,派给其他玩家,自己手上越少越好,直到派光。例如,得到421最佳组合后,可以将10个筹码派给此轮掷骰子得分最低的筹码组合获得者,谁的筹码派光了,谁赢。
3. 所有骰子组合:
a. 三个骰子的组合为:6*6*6 = 216种可能
b. 得到421的可能:124, 142, 214, 241, 412, 421六个组合。6 / 216 = 1 / 36
c. 得到666,555,444,333,222,111的可能:六个组合。6 / 216 = 1 / 36
d. 得到30 种两个相同数字与一个不同数字组合 :112 113 114 115 116 ;122 223 224 225 226 ;133 233 334 335 336 ;144 244 344 445 446 ;155 255 355 455 556 ;166 266 366 466 566 ,三十个组合。此组合再乘3,例如112 121 211,得到30*3= 90 / 216
e. 得到三个不同数字组合:123 124 125 126 134 135 136 145 146 156 ,234 235 236 245 246 256 ,345 346 356,456 ,二十个组合。此组合再乘以6, 得到 20*6 = 120 / 216 (包括6个“421”:124, 142, 214, 241, 412, 421)
f. 共计216种组合。
分配多少筹码是由投出的骰子组合所决定的。以下是骰子组合与筹码的对应表:
骰子组合 对应筹码个数
421得 10 个筹码;
111得 7 个筹码;
116 或者 666 得 6 个筹码;
115 或者 555 得 5 个筹码;
114 或者 444 得 4 个筹码;
113 或者 333 得 3 个筹码;
112 或者 222 得 2 个筹码;
顺子 (例如 123; 234; 345;或者 456等等) 2 个筹码;
所有其他组合 1 个筹码
4. 此程序可以进行100000次模拟游戏。

http://www.oschina.net/code/snippet_1395553_27107

 #!/usr/bin/python
#coding:utf8

import random
import time

def get_dice():
    return random.randint(1,7)

def the_open(player_dice,computer_dice):
    print '双方开:'
    time.sleep(1)
    print '玩家:' + str(player_dice)
    time.sleep(1)
    print '电脑:' + str(computer_dice)
    time.sleep(1)

def every_game(player_money,computer_money):
    print 'Get Ready~~~'
    time.sleep(1)
    print 'Go!'
    time.sleep(2)
    print "双方筹码:"
    print '玩家:' + str(player_money)
    print '电脑:' + str(computer_money)
    time.sleep(2)
    print '玩家掷点:',
    time.sleep(1)
    player_dice = get_dice()
    print '您得到的点数为' + str(player_dice)
    time.sleep(2)
    print '电脑掷点:',
    time.sleep(1)
    computer_dice = get_dice()
    print '电脑掷点完毕!'
    time.sleep(1)
    result = raw_input('玩家方先下注,是否下注?[y/N]')
    if result.lower() == 'y':
        while True:
            player_bets = input('选择下注范围:[1-{0}]'.format(player_money))
            if player_bets >= 1 and player_bets <= player_money:
                break
        print '玩家下注{0}'.format(player_bets)
        time.sleep(1)
        print '电脑思考中...',
        time.sleep(2)
        if random.choice('yn') == str('y'):
            computer_bets = random.randint(1,computer_money)
            print '电脑下注{0}'.format(computer_bets)
            time.sleep(1)
            the_open(player_dice,computer_dice)
            if player_dice > computer_dice:
                print '玩家胜!玩家赢得筹码{0}'.format(computer_bets)
                player_money += computer_bets
                computer_money -= computer_bets
            elif player_dice == computer_dice:
                print '平局!双方收回各自筹码!'
            else:
                print '电脑胜!玩家输掉筹码{0}'.format(player_bets)
                player_money -= player_bets
                computer_money += player_bets
        else:
            print '电脑放弃下注!玩家收回自己的筹码!'
            time.sleep(1)
            the_open(player_dice,computer_dice)
    else:
        print '玩家放弃下注,本局放弃!'
        time.sleep(1)
        the_open(player_dice,computer_dice)
    return [player_money,computer_money]

def play_game():
    print '游戏开始!'
    player_money = 100
    computer_money = 100
    time.sleep(1)
    while player_money != 0 and computer_money != 0:
        money_list = every_game(player_money,computer_money)
        player_money = money_list[0]
        computer_money = money_list[1]
    if player_money == 0:
        print 'You Lose!'
    else:
        print 'You Win!'

if __name__ == '__main__':
    play_game()