文章
树洞

赚钱的方法(概率论和计算机科学)

邹韬奋 外逃贪官CA
邹韬奋  ·  2021年3月17日 虽然韬光养晦,亦当奋起而争(拜登永不为奴:h.2047.one)

说到码农的事情,我虽然不是码农,可是也会写一些简单的计算机程序。

比如下面的问题:如何在21点(Blackjack)中找出求生之道。

21点数牌的技术(card counting)早就出了书拍了电影了。但是赌场居然还在经营21点赌博,真的是赌场活雷锋给大伙送钱?

传统的21点赌术要求玩家熟记概率表,对人的准确性要求很高,所以赌场一千个赌客里都未必有一个能记得住的,赌场才能正常运转。

我这里当然不是指望在座的各位有拉马努金之才,而是使用计算机来近似处理此概率论问题。赌场有在线版的(“性感荷官,在线发牌”https://www.youtube.com/watch?v=hQDffm_7c38),别的赌博术我没有学会,什么百家乐(baccarat),德州扑克(Texas Hold'em),Craps(赌骰子)之类的我看不懂,也就不讨论了。

维基百科上列一些数牌术的参考文献:

Axelrad, Josh (2010). Repeat until Rich: A Professional Card Counter's Chronicle of the Blackjack Wars. New York: Penguin Press. ISBN 978-1-59420-247-6.

Griffin, Peter (1988). The Theory of Blackjack: The Complete Card Counter's Guide (4th ed.). Las Vegas: Huntington Press. ISBN 0-915141-02-7.

Eddie Olsen (April 18, 1981). "Ken Uston: Big Player Without a Game". The Philadelphia Inquirer.

Rose, I. Nelson; Loeb, Robert A. (1998). Blackjack and the Law (1st ed.). Oakland, CA: RGE Publishers. ISBN 978-0-910575-08-9. Schlesinger, Donald (2005). Blackjack Attack: playing the pros' way (3rd ed.). Las Vegas: RGE Publishing. ISBN 978-0-910575-20-1.

Snyder, Arnold (2006). The Big Book of Blackjack (1st ed.). New York: Cardoza Publishing. ISBN 1-58042-155-5.

Thorp, Edward O. (1966). Beat the Dealer: A Winning Strategy for the Game of Twenty One. New York: Vintage Books. ISBN 0-394-70310-3.

Walker, Katarina (2008). The Pro's Guide to Spanish 21 and Australian Pontoon. New York: Maven Press. ISBN 978-1-4357-1065-8.

Zender, Bill (2006). Advantage Play for the Casino Executive. OCLC 156916229.

Snyder, Arnold (2005). Blackbelt in Blackjack: Playing 21 as a Martial Art (Revised ed.). New York: Cardoza Publishing. ISBN 1-58042-143-1.

但是我不读书也不懂这些玩意,只能读懂摘要,大致是说,21点里,剩余牌张的大牌(10和花牌)越多越好,小牌(23456)越少越好。所以我约定就是在大牌比重超过一定程度时就入场。

入场之后就要计算概率,到底是要牌还是不要牌,要牌的话要不要加倍,要不要分牌,要不要投降之类的。

上图为基本概率表。靠基本概率表,你的数学期望约为0.997,也就是每赌100块会输三毛钱,21点赌得很快,一分钟不到就一盘,几个小时之后你就输光了,而根据本人在赌场的亲自观察,大部分赌客连上面的基本表都不会用。所以大部分赌客是直挺挺走进去,内裤都输光扔出来。

菜单
  1. thphd   2047前站长

    这个概率表指的是洗牌之后的概率,如果入场时大牌比重较大,期望会高于1对吧

  2. 邹韬奋 外逃贪官CA
    邹韬奋   虽然韬光养晦,亦当奋起而争(拜登永不为奴:h.2047.one)

    @thphd #131587 假设牌洗的均匀。以下为程序(Python),原谅我的渣排版。如果要测试的话请注意缩进。多谢码农朋友们帮我修正排版

    
    import random
    import math
    
    def total(hand):
        aces=hand.count(11)
        t = sum(hand)
        if t > 21 and aces > 0:
            while aces > 0 and t > 21:
                t -= 10
                aces -= 1
        return t                      ## hand=[11,11,6], total(hand) is 18
    
    def deal(player,cards):
        rc=random.choice(cards)
        player.append(rc)
        cards.remove(rc)
    
    number_deck=8
    
    a=[0,0,0,0,0,0,0,0,0,0]  # cards left
    b=[0,0,0,0,0,0,0,0,0,0]   # percentage
    
    prb=[-2,-1,1,1,2,2,2,1,0,0] # each card take away
    
    exp_value=exp=0
    
    for x in range(10):
        a[int(x)]=4*number_deck
    a[0]=4*number_deck*4    #initialization
    
    
    while True:
        string=input("please enter:")
    
        if string=='me': #me calculate the mathematical expectation of stand or hit once, if hit once has larger than 100% exp, then player should double if they can; if both expectation below 50%, player should surrender if they can
            stand_or_hit=0   # stand=0   hit_once=1 
            compare=[0,0]
            my_cards=[]
            dealer_cards=[]
    
            my_cards_string=input("my cards:")
            dealer_cards_string=input("dealer cards:")
    
            for x in my_cards_string:
               if x>='0' and x<='9':
                                     if int(x)<2:
                                        my_cards.append(int(x)+10)
                                     else:
                                        my_cards.append(int(x))
            if len(dealer_cards_string) < 2:
                if dealer_cards_string>='0' and dealer_cards_string<='9':
                   if int(dealer_cards_string)<2:
                                    dealer_cards.append(int(dealer_cards_string)+10)                 
                   else: 
                                    dealer_cards.append(int(dealer_cards_string))
            cards_ini=[]
            for x in range(10):
                for s in range(a[x]):
                    if x<2:
                        cards_ini.append(x+10)
                    else:   
                        cards_ini.append(x)
    
            while stand_or_hit<=1:
                try_times=0
                exp_return=0
               
                while try_times<30000:
                    my=list(my_cards)
                    dealer=list(dealer_cards)
                    cards=list(cards_ini)
                    
                    if stand_or_hit==1:
                        deal(my,cards)
    
                    deal(dealer,cards)
                    total_dealer=total(dealer)
    
    
                    while True:
                        if total_dealer>=17:
                            break
                        else:
                            deal(dealer,cards)
                            total_dealer=total(dealer)
    
                    total_my=total(my)
                    
                    if total_my>21:exp_return+=0
                    elif total_dealer>21: exp_return+=2
                    elif dealer==[10,11] or dealer==[11,10]:exp_return+=0
                    elif total_my>total_dealer: exp_return+=2
                    elif total_my==total_dealer: exp_return+=1
                    else: exp_return+=0
                        
                    try_times+=1
                compare[stand_or_hit]=round(exp_return/300,1)     #bet 100, expected return
                stand_or_hit+=1
            print(compare)
    
        if string=='split': # calculate split expectation
    
            compare=[0,0]
            my_cards=[]
            dealer_cards=[]
            stand_or_split=0
            my_cards_string=input("my cards:")
            dealer_cards_string=input("dealer cards:")
    
            for x in my_cards_string:
               if x>='0' and x<='9':
                                     if int(x)<2:
                                        my_cards.append(int(x)+10)
                                     else:
                                        my_cards.append(int(x))
            
            
            if len(dealer_cards_string) < 2:
                if dealer_cards_string>='0' and dealer_cards_string<='9':
                   if int(dealer_cards_string)<2:
                                    dealer_cards.append(int(dealer_cards_string)+10)                 
                   dealer_cards.append(int(dealer_cards_string))
            cards_ini=[]
            for x in range(10):
                for s in range(a[x]):
                    if x<2:
                        cards_ini.append(x+10)
                    else:   
                        cards_ini.append(x)
    
    
            try_times=0
            exp_return=0
            my1=[]
            my2=[]
            my1.append(my_cards[0])
            my2.append(my_cards[1]) #my two hands
            while stand_or_split <= 1:
               try_times=0
               exp_return=0
               while try_times<30000:
                    myhand1=list(my1)
                    myhand2=list(my2)
                    dealer=list(dealer_cards)
                    cards=list(cards_ini)
                    
                    if stand_or_split==1:
                        deal(myhand1,cards)
                        deal(myhand2,cards)
                        deal(dealer,cards)
                        total_dealer=total(dealer)
                        while True:
                            if total_dealer>=17:
                                break
                            else:
                                deal(dealer,cards)
                                total_dealer=total(dealer)
    
                        total_my1=total(myhand1)
                        
                        if total_my1>21:exp_return+=0
                        elif total_dealer>21: exp_return+=2
                        elif dealer==[10,11] or dealer==[11,10]:exp_return+=0
                        elif total_my1>total_dealer: exp_return+=2
                        elif total_my1==total_dealer: exp_return+=1
                        else: exp_return+=0
    
                        total_my2=total(myhand2)
    
                        if total_my2>21:exp_return+=-1
                        elif total_dealer>21: exp_return+=1
                        elif dealer==[10,11] or dealer==[11,10]:exp_return+=0  #Return of split for dealer blackjack
                        elif total_my2>total_dealer: exp_return+=1
                        elif total_my1==total_dealer: exp_return+=0
                        else: exp_return+=-1
                    else:
                        total_dealer=total(dealer)
                        while True:
                                if total_dealer>=17:
                                    break
                                else:
                                    deal(dealer,cards)
                                    total_dealer=total(dealer)
                                    
                        total_my=total(my_cards)#unsplit hands
                        
                        if total_my>21:exp_return+=0
                        elif total_dealer>21: exp_return+=2
                        elif dealer==[10,11] or dealer==[11,10]:exp_return+=0
                        elif total_my>total_dealer: exp_return+=2
                        elif total_my==total_dealer: exp_return+=1
                        else: exp_return+=0
                    try_times+=1
               compare[stand_or_split]=round(exp_return/300,1)     #bet 100, expected return
               stand_or_split+=1
            print(compare)     #bet 100, expected return
            
        elif string>='a' and string<='z':   # to exit, press a nonletter. for example "/"
            pass
            
        else:
            
    
            for x in string:
                    if x<='9' and x>='0':
                       a[int(x)]=a[int(x)]-1
                       exp+=prb[int(x)]
    
            for x in range(10):
                b[int(x)]=round(100*a[int(x)]/sum(a)*13-100,1)
            b[0]=round(100/4*a[0]/sum(a)*13-100,1)
    
            n=2
            stt='10'+'\t'+'A'+'\t'
            while n<10:
            
                stt=stt+str(n)+'\t'
                n+=1
            
            print(stt)
        
            n=0
            stt=''
            while n<10:
            
                stt=stt+str(a[n])+'\t'
                n+=1
            print(stt)
    
            n=0
            stt=''
            while n<10:
            
                stt=stt+str(b[n])+'\t'
                n+=1
            exp_value=round(exp*52/sum(a),1)
            print(stt)
            print("totla cards:"+str(sum(a))+'  '+"expect_value:"+str(exp_value))
            if b[0]>8.3:
                print("insurance OK")        
      
    
  3. 天下无贼  

    搞这些,会编码是最不重要的,关键还是数学要好。我编码几十年,不碰这些,自认数学不好,玩不转这些,发财机会留给别人吧。

  4. 邹韬奋 外逃贪官CA
    邹韬奋   虽然韬光养晦,亦当奋起而争(拜登永不为奴:h.2047.one)

    现在点进去性感荷官在线发牌。妹子肯定会用各种挑逗的眼神要你下注。抵制住诱惑,等待这一局牌结束,荷官拿出一副新洗好的牌开始。你先围观一下。每当桌上出现一张牌,你就记录这张牌点数,输入到计算机程序里。大牌点变大的时候,你就可以开始赌了(注意赌场软件会自动踢出不活跃用户,所以几轮不下注你会被踢出赌桌,请以最快速度坐回去)。

    软件采用蒙特卡洛方法模拟。输入me, 在输入我方和庄家点数之后,软件自动模拟三万次随机发牌,计算要牌和不要牌的数学期望 [Hit Stand],以100为注。两者皆小于50(50%)投降,要一张牌的数学期望大于100的时候加倍下注(特别是你的总和是9,10,11的时候)。对于split我没有好的算法,所以请按照常用的概率表玩。通常来说,你有两张十(含花牌)的时候对上庄家的5和6,是不建议分牌的,但是当大牌点大于一定程度的时候,分牌是有利可图的。本程序另有split功能处理此,输入split,输入我方点数00,输入庄家点数,显示的数学期望是[Stand Split]。

    我举个例子吧:

    please enter:66666666666666666666666666
    
    10	A	2	3	4	5	6	7	8	9	
    
    127	32	32	32	32	32	6	32	32	31	
    
    6.4	7.2	7.2	7.2	7.2	7.2	-79.9	7.2	7.2	3.9	
    
    totla cards:388  expect_value:6.7
    
    please enter:6555555555555555555555555555555
    
    10	A	2	3	4	5	6	7	8	9	
    
    127	32	32	32	32	2	5	32	32	31	
    
    15.6	16.5	16.5	16.5	16.5	-92.7	-81.8	16.5	16.5	12.9	
    
    totla cards:357  expect_value:16.3
    
    insurance OK
    
    please enter:split
    
    my cards:00
    
    dealer cards:6
    
    [181.6, 187.9]
    
    please enter:me
    
    my cards:03
    
    dealer cards:3
    
    [91.3, 69.1]
    
    

    在扔掉一堆小牌之后,局势对玩家有利。

    假设你运气好,上桌拿了两个十,庄家还是6,你已经胜券在握了,现在测试split。结果是[181.6, 187.9],也就是你不分牌,数学期望是1.816,分牌则是1.879。 如果你上来拿了13点,庄家是三点,结果是[91.3, 69.1],也就是说如果你不要牌,数学期望是0.913,要一张牌之后数学期望是0.691 所以你不应该要牌。

    这里的要牌只能要一张牌,所以当你手上牌小于9的时候,会忽略多次要牌的局势,从而得出错误的结论。所以这种情况下请闭着眼睛要牌(按照基本概率表)。

  5. 邹韬奋 外逃贪官CA
    邹韬奋   虽然韬光养晦,亦当奋起而争(拜登永不为奴:h.2047.one)

    @rebecca #131479

    现在该回答丽贝卡的问题了。就我的印象而言,当赔率改变的“瞬间”(我也不知道延时是多少),下注会失败。所以要尽快下注。

    赔率的统计方法是用爬虫爬sportsbookreview的网站,这个程序是五年前的,由于网站改版而失效,如果要用的话,得重新调试爬虫了。我使用python和BeautifulSoup软件包。

    import urllib.request
    from bs4 import BeautifulSoup
    import re
    import time
    import datetime
    
    
    def to_int(s):
    	if s=='even':
    		return 100
    	elif s=='Even':
    		return 100
    	elif s=='EVEN':
    		return 100
    	elif s=='-':
    		return -9999
    
    	else:
    		try:
    			return int(s)
    		except TypeError:
    			return -9999
    
    
    
    def odds_list(url,name):
            rotNumber=[]
            moneyline=[]
            dic={}
            matchname={}
            gamedate={}
            gamehour={}
            #c = ntplib.NTPClient()
            #print(c)
            #response = c.request('time.nist.gov', version=3)
            #print(time.ctime(response.tx_time))
            #url = "http://www.sportsbookreview.com/betting-odds/ufc/"
            page=urllib.request.urlopen(url)
            #print(url)
            soup = BeautifulSoup(page.read())
            #soup = BeautifulSoup(open("./sbr_"+"mlb"+"_moneyline.html"))
            a=[[0 for x in range(10)] for x in range(1000)] 
            b=[[0 for x in range(10)] for x in range(1000)] 
            i=0
            j=0
            #print(a)
            for list in soup.find_all("div", attrs={"class": re.compile("^(eventLine-book-value)")}):
                    for ss in list.find_all("b"):	
                            if j%2==0:	
                                    a[i][j//2]=to_int(ss.string)
    
                            else:
                                    b[i][j//2]=to_int(ss.string)	
                                    	        
                            j+=1
    
                            if j==20:
                                    j=0
                                    i+=1
                                    
    
            i=0
            #print(a)
            #print(b)
            for list1 in soup.find_all(itemprop="name"):
                    #print(list1)
                    matchname[i//2]=list1
                    
                    
                    dic[i]=a[i//2]
                    i+=1
                    dic[i]=b[i//2]
                    i+=1
    
    
            i=0
            for list2 in soup.find_all(itemprop="startdate"):
                    #print(list2)
                    times=list2.attrs['content']
                    dates=times[0:10]
                    #print(dates)
                    hours=times[11:16]
                    #print(hours)                
                    
                    gamedate[i//2]=dates
                    gamehour[i//2]=hours              
                    #print(gamedate[i//2])
                    #print(gamehour[i//2]) #                        print(gamedate[i//2]
                    #dic[i]=a[i//2]
                    #moneyline[i]=line1[i//2]
                    i+=1
                    #dic[i]=b[i//2]
                    #moneyline[i]=line2[i//2]                
                    i+=1
            currenttime='{:%H:%M}'.format(datetime.datetime.time(datetime.datetime.now()))
            currentdate=str(datetime.date.today())
                    #for key in dic:
                    #	print(key,dic[key],len(dic[key]),'\n')
    
            #print(gamedate)
            #print(gamehour)
            #print(matchname)
            #print(currenttime)
            #print(currentdate)
            for key in dic:
                    #print(key)
                    #print(gamedate[key//2])
                    #print(gamehour[key//2])                            
                    if key%2==1:
    
                            if ((dic[key][2]+dic[key-1][3]>-2 or dic[key][3]+dic[key-1][2]>-2) and (gamedate[key//2]>currentdate or (gamedate[key//2]==currentdate and gamehour[key//2]>currenttime)) and dic[key][2]!=0 and dic[key][3]!=0 ):
                                    #print((gamedate[key//2]>currentdate or (gamedate[key//2]==currentdate and gamehour[key//2]>currenttime)))
                                    print(name,matchname[key//2],dic[key][2],dic[key-1][3])
                                    print(name,matchname[key//2],dic[key][3],dic[key-1][2])
                            #if max(dic[key])+max(dic[key-1])>0:
                                    #print(name,matchname[key//2],max(dic[key]),max(dic[key-1]))
            #print(name)
    def odds_list_fight(url,name):
            rotNumber=[]
            moneyline=[]
            dic={}
            matchname={}
            gamedate={}
            gamehour={}        #c = ntplib.NTPClient()
            #print(c)
            #response = c.request('time.nist.gov', version=3)
            #print(time.ctime(response.tx_time))
            #url = "http://www.sportsbookreview.com/betting-odds/ufc/"
            page=urllib.request.urlopen(url)
            #print(url)
            soup = BeautifulSoup(page.read())
            #soup = BeautifulSoup(open("./sbr_"+"mlb"+"_moneyline.html"))
            a=[[0 for x in range(10)] for x in range(1000)] 
            b=[[0 for x in range(10)] for x in range(1000)] 
            i=0
            j=0
            #print(a)
            for list in soup.find_all("div", attrs={"class": re.compile("^(eventLine-book-value)")}):
                    for ss in list.find_all("b"):	
                            if j%2==0:	
                                    a[i][j//2]=to_int(ss.string)
    
                            else:
                                    b[i][j//2]=to_int(ss.string)	
                                    	        
                            j+=1
    
                            if j==20:
                                    j=0
                                    i+=1
                                    
    
            i=0
            #print(a)
            #print(b)
            for list1 in soup.find_all(itemprop="name"):
                    #print(list1)
                    matchname[i//2]=list1
                    
                    
                    dic[i]=a[i//2]
                    i+=1
                    dic[i]=b[i//2]
                    i+=1
    
    
            i=0
            #print(dic)
            #print(line1)
            #print(line2)
            #print(matchname)
            for list2 in soup.find_all(itemprop="startdate"):
                    #print(list2)
                    times=list2.attrs['content']
                    dates=times[0:10]
                    #print(dates)
                    hours=times[11:16]
                    #print(hours)                
                    
                    gamedate[i//2]=dates
                    gamehour[i//2]=hours              
                    
                    #dic[i]=a[i//2]
                    #moneyline[i]=line1[i//2]
                    i+=1
                    #dic[i]=b[i//2]
                    #moneyline[i]=line2[i//2]                
                    i+=1
            currenttime='{:%H:%M}'.format(datetime.datetime.time(datetime.datetime.now()))
            currentdate=str(datetime.date.today())
    
                    #for key in dic:
                    #	print(key,dic[key],len(dic[key]),'\n')
            #print(dic)
            #print(matchname)
            for key in dic:
                    #print(key)               
                    if key%2==1:
                            if ((dic[key][0]+dic[key-1][2]>-2 or dic[key][2]+dic[key-1][0]>-2) and (gamedate[key//2]>currentdate or (gamedate[key//2]==currentdate and gamehour[key//2]>currenttime)) and dic[key][2]!=0  ):
                                    print(name,matchname[key//2],dic[key][0],dic[key-1][2])
                                    print(name,matchname[key//2],dic[key][2],dic[key-1][0])
                            #if max(dic[key])+max(dic[key-1])>0:
                                    #print(name,matchname[key//2],max(dic[key]),max(dic[key-1]))
            #print(name)
    def odds_list_spread(url,name):
            rotNumber=[]
            moneyline={}
            gamedate={}
            gamehour={}
            dic={}
            matchname={}
            #c = ntplib.NTPClient()
            #print(c)
            #response = c.request('time.nist.gov', version=3)
            #print(time.ctime(response.tx_time))
            #url = "http://www.sportsbookreview.com/betting-odds/ufc/"
            page=urllib.request.urlopen(url)
            #print(url)
            soup = BeautifulSoup(page.read())
            #soup = BeautifulSoup(open("./sbr_"+"mlb"+"_moneyline.html",encoding='utf8'))
    
            a=[[0 for x in range(10)] for x in range(1000)] 
            b=[[0 for x in range(10)] for x in range(1000)] 
            line1=[[0 for x in range(10)] for x in range(1000)] 
            line2=[[0 for x in range(10)] for x in range(1000)]
            i=0
            j=0
            #print(j)
           
            for list in soup.find_all("div", attrs={"class": re.compile("^(eventLine-book-value)")}):
                    
                    for ss in list.find_all("b"):	
                            #print(ss)
                            if j%2==0:
                                if ss.string:
                                    if ss.string[0:2] == "PK": # PK (Even)
                                       #print("PK")
                                       line1[i][j//2]="PK"                               
                                       a[i][j//2]=to_int(ss.string[2:])   
                                    else:
                                       #print(ss.string[0:2])
                                       line1[i][j//2]=ss.string.split('\xa0')[0]                             
                                       a[i][j//2]=to_int(ss.string.split('\xa0')[1]) 
    
                            else:
                                if ss.string: 
                                    if ss.string[0:2] == "PK": # PK (Even)
                                       #print("PK")                              
                                       line2[i][j//2]="PK"                               
                                       b[i][j//2]=to_int(ss.string[2:])   
                                    else:
                                       #print(ss.string[0:2])
                                       line2[i][j//2]=ss.string.split('\xa0')[0]
                                       b[i][j//2]=to_int(ss.string.split('\xa0')[1])                               	        
                            j+=1
    
                            if j==20:
                                    j=0
                                    i+=1
                                    
    
            i=0
            #print(line1)
            #print(line2)
            #print(a)
            #print(b)
            for list1 in soup.find_all(itemprop="name"):
                    #print(list1)
                    matchname[i//2]=list1
                  
                    
                    dic[i]=a[i//2]
                    #moneyline[i]=line1[i//2]
                    i+=1
                    dic[i]=b[i//2]
                    #moneyline[i]=line2[i//2]                
                    i+=1
                    #for key in dic:
                    #	print(key,dic[key],len(dic[key]),'\n')
            i=0
            #print(dic)
            #print(line1)
            #print(line2)
            #print(matchname)
            for list2 in soup.find_all(itemprop="startdate"):
                    #print(list2)
                    times=list2.attrs['content']
                    dates=times[0:10]
                    #print(dates)
                    hours=times[11:16]
                    #print(hours)                
                    
                    gamedate[i//2]=dates
                    gamehour[i//2]=hours              
                    
                    #dic[i]=a[i//2]
                    #moneyline[i]=line1[i//2]
                    i+=1
                    #dic[i]=b[i//2]
                    #moneyline[i]=line2[i//2]                
                    i+=1
            currenttime='{:%H:%M}'.format(datetime.datetime.time(datetime.datetime.now()))
            currentdate=str(datetime.date.today())
            for key in dic:
                    #print(key)               
                    if key%2==1:
                       if 1:
                            if ((dic[key][4]+dic[key-1][3]>-2 or dic[key][3]+dic[key-1][4]>-2) and (gamedate[key//2]>currentdate or (gamedate[key//2]==currentdate and gamehour[key//2]>currenttime)) and dic[key][3]!=0 and dic[key][4]!=0 ):
                                    print(name,matchname[key//2],dic[key][4],dic[key-1][3])
                                    print(name,matchname[key//2],dic[key][3],dic[key-1][4])
                            #if max(dic[key])+max(dic[key-1])>0:
                                    #print(name,matchname[key//2],max(dic[key]),max(dic[key-1]))
            #print(name)
    def odds_list_spread_fight(url,name):
            rotNumber=[]
            moneyline=[]
            dic={}
            matchname={}
            #c = ntplib.NTPClient()
            #print(c)
            #response = c.request('time.nist.gov', version=3)
            #print(time.ctime(response.tx_time))
            #url = "http://www.sportsbookreview.com/betting-odds/ufc/"
            page=urllib.request.urlopen(url)
            #print(url)
            soup = BeautifulSoup(page.read())
            #soup = BeautifulSoup(open("./sbr_"+"mlb"+"_moneyline.html",encoding='utf8'))
    
            a=[[0 for x in range(10)] for x in range(1000)] 
            b=[[0 for x in range(10)] for x in range(1000)] 
            line1=[[0 for x in range(10)] for x in range(1000)] 
            line2=[[0 for x in range(10)] for x in range(1000)]
            i=0
            j=0
            #print(j)
           
            for list in soup.find_all("div", attrs={"class": re.compile("^(eventLine-book-value)")}):
                    #print (list)
                    
                    for ss in list.find_all("b"):	
                            #print(ss)
                            if j%2==0:
                                if ss.string: 
                                    line1[i][j//2]=ss.string.split('\xa0')[0]                               
                                    a[i][j//2]=to_int(ss.string.split('\xa0')[1])   
                            else:
                                if ss.string: 
                                    line2[i][j//2]=ss.string.split('\xa0')[0]
                                    b[i][j//2]=to_int(ss.string.split('\xa0')[1])
                                    	        
                            j+=1
    
                            if j==20:
                                    j=0
                                    i+=1
                                    
                    
            i=0
            #print(a)
            #print(b)
            for list1 in soup.find_all(itemprop="name"):
                    #print(list1)
                    matchname[i//2]=list1
                  
                    
                    dic[i]=a[i//2]
                    #moneyline[i]=line1[i//2]
                    i+=1
                    dic[i]=b[i//2]
                    #moneyline[i]=line2[i//2]                
                    i+=1
    
    
    
    
                    #for key in dic:
                    #	print(key,dic[key],len(dic[key]),'\n')
            #print(dic)
            #print(line1)
            #print(line2)
            #print(matchname)
            #print(line1)
            #print(line2)
            for key in dic:
                    #print(key)               
                    if key%2==1:
                       if 1:
                            if ((dic[key][1]+dic[key-1][3]>-2 or dic[key][3]+dic[key-1][1]>-2) and dic[key][3]!=0 and dic[key][1]!=0):
                                    print(name,matchname[key//2],dic[key][1],dic[key-1][3])
                                    print(name,matchname[key//2],dic[key][3],dic[key-1][1])
                            #if max(dic[key])+max(dic[key-1])>0:
                                    #print(name,matchname[key//2],max(dic[key]),max(dic[key-1]))
            #print(name)                                
    while(1):
            odds_list("http://www.sportsbookreview.com/betting-odds/tennis/","Tennis")
    
            odds_list("http://www.sportsbookreview.com/betting-odds/nfl-football/money-line/","NFL")
            odds_list("http://www.sportsbookreview.com/betting-odds/nfl-football/money-line/1st-half","NFL 1st half")
            odds_list("http://www.sportsbookreview.com/betting-odds/nfl-football/money-line/2nd-half","NFL 2nd half")
            odds_list("http://www.sportsbookreview.com/betting-odds/nfl-football/money-line/1st-quarter","NFL 1st quarter")
            odds_list("http://www.sportsbookreview.com/betting-odds/nfl-football/money-line/2nd-quarter","NFL 2nd quarter")
    
            odds_list("http://www.sportsbookreview.com/betting-odds/nfl-football/money-line/3rd-quarter","NFL 3rd quarter")
            odds_list("http://www.sportsbookreview.com/betting-odds/nfl-football/money-line/4th-quarter","NFL 4th quarter")
    
            odds_list("http://www.sportsbookreview.com/betting-odds/college-football/money-line/","NCAA Football")
            odds_list("http://www.sportsbookreview.com/betting-odds/mlb-baseball/","MLB")
            odds_list("http://www.sportsbookreview.com/betting-odds/nba-basketball/money-line/","NBA")
            odds_list("http://www.sportsbookreview.com/betting-odds/nba-basketball/money-line/1st-half","NBA 1st half")
            odds_list("http://www.sportsbookreview.com/betting-odds/nba-basketball/money-line/2nd-half","NBA 2nd half")
            odds_list("http://www.sportsbookreview.com/betting-odds/nba-basketball/money-line/1st-quarter","NBA 1st quarter")
            odds_list("http://www.sportsbookreview.com/betting-odds/nba-basketball/money-line/2nd-quarter","NBA 2nd quarter")
            odds_list("http://www.sportsbookreview.com/betting-odds/nba-basketball/money-line/3rd-quarter","NBA 3rd quarter")
            odds_list("http://www.sportsbookreview.com/betting-odds/nba-basketball/money-line/4th-quarter","NBA 4th quarter")
            odds_list("http://www.sportsbookreview.com/betting-odds/ncaa-basketball/money-line/","NCAA Basketball")
            odds_list("http://www.sportsbookreview.com/betting-odds/ncaa-basketball/money-line/1st-half","NCAAB 1st half")
            odds_list("http://www.sportsbookreview.com/betting-odds/ncaa-basketball/money-line/2nd-half","NCAAB 2nd half")
            odds_list("http://www.sportsbookreview.com/betting-odds/wnba-basketball/money-line/","WNBA")
    
            odds_list("http://www.sportsbookreview.com/betting-odds/nhl-hockey/","NHL")
    
            odds_list("http://www.sportsbookreview.com/betting-odds/nhl-hockey/1st-quarter","NHL 1Q")
            odds_list("http://www.sportsbookreview.com/betting-odds/nhl-hockey/2nd-quarter","NHL 2Q")
            odds_list("http://www.sportsbookreview.com/betting-odds/nhl-hockey/3rd-quarter","NHL 3Q")
            odds_list_fight("http://www.sportsbookreview.com/betting-odds/boxing/","Boxing")
            odds_list_fight("http://www.sportsbookreview.com/betting-odds/ufc/","UFC")
    
    
            print('{:%H:%M}'.format(datetime.datetime.time(datetime.datetime.now())))
    
    
  6. 邹韬奋 外逃贪官CA
    邹韬奋   虽然韬光养晦,亦当奋起而争(拜登永不为奴:h.2047.one)

    @天下无贼 #131599 我这都是中学数学,你说看不懂就不应该了吧。

    好了,本期讲座“业余码农的逆袭”到此结束了。根据本人的历史经验,一天干八个小时数学期望应该有两百美元。当然前提是你有足够多的初始资金去赌场劳动。

    下期预告:(没有任何注释)

    28.4
    
    v = 591;
    m = 6.6*10^-27;
    q = 3.2*10^-19;
    B = 0.045;
    Angle = 52 Degree;
    q*B*v/m/10^6*Sin[Angle]
    
    1016.1
    
    28.9
    
    In[240]:= m = 9.11*10^-31;
    V1 = 1000;
    q = 1.6*10^-19;
    v = Sqrt[2 V1 q/m];
    d = 0.02;
    V2 = 117.3;
    E2 = V2/d;
    B = E2/v*10^3
    
    Out[247]= 0.312934
    
    28.13
    
    In[248]:= i = 6.6;
    w = 0.00015;
    B = 0.65;
    n = 8.47*10^28;
    q = 1.6*10^-19;
    i*B/n/q/w*10^6
    
    Out[253]= 2.11039
    
    28.24
    
    In[254]:= m = 9.11*10^-31;
    V = 297.9;
    v = Sqrt[2 V q/m]/10^7
    
    
    Out[256]= 1.02294
    
    In[257]:= v = 1.11*10^7;
    B = 0.21;
    m*v/q/B*10^6
    
    Out[259]= 300.955
    
    28.5
    
    B = {Bx, 3 Bx, 0};
    v = {2, 3.5, 0};
    Cross[v, B]
    
    {0., 0, 2.5 Bx}
    
    -4/2.5
    
    -1.6
    
    28.14
    
    v = 5.09;
    v/8.5/1.2
    
    0.49902
    
    28.21
    
    q = 1.6*10^-19;
    m = 9.11*10^-31;
    ke = 1200 q;
    r = 0.329;
    v = Sqrt[2 ke/m];
    t = 2 Pi*r/v*10^9
    
    100.686
    
    28.26
    
    mp = 1.673*10^-27;
    q = 1.6*10^-19;
    t = 223*10^-9;
    Pi*mp/q/t
    
    0.147306
    
    28.29
    
    m = 9.11*10^-31;
    B = 0.3;
    T = 2 Pi*m/q/B;
    vx = 8.87*10^-6/T;
    F = 2*10^-15;
    vy = F/B/q;
    Sqrt[vx^2 + vy^2]/1000
    
    85.257
    
    29.8
    
    R2 = 0.078;
    R1 = 0.0486;(*variable*)
    u0 = 4 Pi*10^-7;
    i = 0.281;
    -(u0*i/4/R1 - u0*i/4/R2)*10^6
    
    
    -0.684656
    
    29.11
    
    i1 = 8.01;(*variable*)
    d1 = 0.75;
    d2 = 1.5;
    -i1/(d1 + d2)*d2
    
    -5.34
    
    29.27
    
    i1 = 30;
    i2 = 40;
    B1 = {i1, i2};
    Th = ArcTan[i2/i1];
    B2 = {i2/Tan[ArcTan[i2/i1] - 36.89 Degree], i2}(*angle is variable*)
    
    {137.322, 40}
    
    29.47
    
    j0 = 310;
    a = 0.00337;
    1/3*u0*j0*a/4*10^6
    
    0.109401
    
    29.55
    
    n = 1000;
    i1 = 0.02;
    B1 = u0*n*i1;
    i2 = 6.8;(*variable*)
    u0*i2/2/Pi/B1*100
    
    5.41127
    
    28.2
    
    In[235]:= m = 41*10^-3;
    q = 80*10^-6;
    v = 20*10^3;
    g = 9.8;
    m*g/q/v*1000
    
    Out[239]= 251.125
    
    q
    
    1.6*10^-19
    
    28.10
    
    B = 2.5;
    v = 2000;
    ef = 5.35;
    (B*v + ef)*q
    
    8.00856*10^-16
    
    28.41
    
    m = 0.013;
    L = 0.62;
    g = 9.81;
    B = 0.54;
    m*g/L/B
    
    0.380914
    
    28.56
    
    dip = 0.15^2*Pi*2.6;
    Angle = 56 Degree;
    Sin[Angle]*dip*12
    
    1.82836
    
  7. 邹韬奋 外逃贪官CA
    邹韬奋   虽然韬光养晦,亦当奋起而争(拜登永不为奴:h.2047.one)
  8. 钢铁雄心 (^_^)?
    钢铁雄心   (钓鱼网站已屏蔽)

    基本规则的数学期望约为0.997,所以赌场🎰方面加一个对玩家有利的额外小规则就超过1了

  9. 邹韬奋 外逃贪官CA
    邹韬奋   虽然韬光养晦,亦当奋起而争(拜登永不为奴:h.2047.one)

    @品葱 #131628 赌场只会加一个对玩家不利的额外小规则。

  10. 爱狗却养猫 饭丝
    爱狗却养猫  

    @消极 #131627 您老不如搞一个菠菜致富网,将深度分析和代码都设置为VIP会员专享福利。:)

  11. 邹韬奋 外逃贪官CA
    邹韬奋   虽然韬光养晦,亦当奋起而争(拜登永不为奴:h.2047.one)
  12. 钢铁雄心 (^_^)?
    钢铁雄心   (钓鱼网站已屏蔽)

    还不如玩选举赌盘,政治会让很多人做出错误的选择,导致赔率极为有利

  13. 爱狗却养猫 饭丝
    爱狗却养猫  
  14. 邹韬奋 外逃贪官CA
    邹韬奋   虽然韬光养晦,亦当奋起而争(拜登永不为奴:h.2047.one)

    @品葱 #131632 是啊,到十一月中旬赌场上川普还有10%胜率。 @爱狗却养猫 #131633 这个是正式版的程序,生产力工具。

  15. thphd   2047前站长

    蒙特卡罗万岁。同py中人,握手。

    问题:消极大师总共在赌场身上刨了多少?

  16. 邹韬奋 外逃贪官CA
    邹韬奋   虽然韬光养晦,亦当奋起而争(拜登永不为奴:h.2047.one)

    @thphd #131635 五年前我玩在线赌场时候有一个更加令人发指的bug(我认为足够开除他们码农了),你从博彩网站转钱到性感荷官在线发牌网站的时候,有一定bug发生double spending,也就是你这边钱还在,那边无中生有多出同样一笔钱。概率虽然小,但是只要你经常使用,早晚会碰到。反过来也有可能,你转出去,钱掉进黑洞里了。但是这时候你可以联系客服,客服调查转账记录就会手动恢复你的钱。但是系统出错多给钱的时候你就闷声发大财。

  17. 爱狗却养猫 饭丝
    爱狗却养猫  
  18. 邹韬奋 外逃贪官CA
    邹韬奋   虽然韬光养晦,亦当奋起而争(拜登永不为奴:h.2047.one)
  19. 爱狗却养猫 饭丝
    爱狗却养猫  

    @消极 #131641 搬张沙发请消老师坐,搬张板凳坐前排。

    我是物理废(学业生涯中唯一一次不及格就是某次物理考试,丢死人),怪不得现在只能赚死工资。

  20. 天下无贼  
    内容已隐藏
    内容已被作者本人或管理员隐藏。 如有疑问,请点击菜单按钮,查看管理日志以了解原因。
  21. Rickroll  

    对赌场这种财大气粗持久战的来说只要赢面比赌客大一点点就能稳定持续的赢钱,但是对于游玩时间短的一般赌客来说数学的占比概率比较小,一颗硬币抛到正反两面的概率都是50%,但是如果只玩几把的话连续抛到同一面也是有可能的

  22. 邹韬奋 外逃贪官CA
    邹韬奋   虽然韬光养晦,亦当奋起而争(拜登永不为奴:h.2047.one)
  23. 邹韬奋 外逃贪官CA
    邹韬奋   虽然韬光养晦,亦当奋起而争(拜登永不为奴:h.2047.one)

    https://pincong.rocks/question/item_id-124287

    @rebecca

    利申,bwin用户。

    由于网站抽成的原因 (只有胜或者负的结果,且两边胜率相等时,赔率为1.9而不是2.0),你每赌一次的期望回报是0.9。

    所以短时间内似乎可以盈利,但只要一直玩下去,默认结局是倾家荡产,除非你能实际上控制比赛。

    再次利申,北大数学系硕士。

    切勿沉迷,提早上岸。


    你的问题我已经初步解决了...