智游城

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 5767|回复: 6
打印 上一主题 下一主题

最近很流行的机器人话题,我贴一部分用按键精灵写的代码

[复制链接]
跳转到指定楼层
1#
rxatom 发表于 2018-8-16 15:53:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
很多平台都有机器人的,这确实是事实,PS ipoker都爆过机器人,像ps 的plo 200都有机器人赢了好像大概200w刀?不过这机器人肯定不是像另外一个帖子提到的什么翻牌前不管任何牌都跟别人all in,假如这是机器人的话,那写这个程序的程序员肯定是个智障。我贴的这个程序去年以前大概能打赢德扑圈的1-2不带anti的级别,总体来讲这个程序打得特别的紧弱,spr>6面对flop的raise它能弃掉底set,在天顺,天花面顶set都会弃掉,所以这程序大概赢率是3bb/100h左右吧,比较弱智,以下是部分源码

Function 翻牌(card1, card2, color1, color2, a1, a2, a3, b1, b2, b3, id)
    Dim flopface,pairface,flashface,wet,power,draw
    flopface = 牌面(a1, a2, a3, b1, b2, b3)
    pairface = CInt(Mid(flopface, 1, 1))
    flashface = CInt(Mid(flopface, 2, 1))
    straightface= CInt(Mid(flopface, 3, 1))
    wet=CInt(Mid(flopface, 3, 1))
    power=牌力(card1,card2,color1,color2,a1,a2,a3,b1,b2,b3)
    draw=Lib.德扑数学.听牌(card1,card2,color1,color2,a1,a2,a3,b1,b2,b3)
    if pairface=2 then
        if power=12 then
            翻牌= "6"+CStr(wet)
        ElseIf power = 4 and card1 >= 12 and card1 >= a1 Then
            翻牌= "5"+CStr(wet)
        elseif power=4 and card1<=11 and card1>=a1 then
            翻牌 = "4" + CStr(wet)
        ElseIf power >= 1 Then
            翻牌 = "2" + CStr(wet)
        ElseIf prepower <= 3 Then//AK
            翻牌 = "1" + CStr(wet)
            else 翻牌= "0"+CStr(wet)
        end if
    elseif  pairface=1 then
        if power>=11 then
            翻牌= "6"+CStr(wet)
        elseif power>=4 then
            if power=5 and a1<>14 and a2<>14 and a3<>14 and (card1=14 or card2=14) then
                翻牌= "5"+CStr(wet)
            elseif card1>=11 and power=4 or power=5 Then
                翻牌 = "4" + CStr(wet)
                Else 翻牌 = "2" + CStr(wet)
            end if
        elseif power>=3 or draw>=2 then
            翻牌 = "2" + CStr(wet)
        ElseIf power = 2 Then
            翻牌 = "1" + CStr(wet)
            else 翻牌= "0"+CStr(wet)
        end if
    elseif flashface=1 then
        if power=10 and (card1=14 or card2=14) or power=12 then
            翻牌= "6"+CStr(wet)
        elseif power=10 and (card1>=12 or card2>=12) then
            翻牌= "5"+CStr(wet)
        elseif power=10 then
            翻牌= "4"+CStr(wet)
        elseif card1=14 and color1=b1 or card2=14 and color2=b2 or power=7 or power=8 or card1=13 and color1=b1 and Lib.德扑数学.三取大(a1, a2, a3)=14 or card2=13 and color2=b2 and Lib.德扑数学.三取大(a1, a2, a3)=14 then
            翻牌= "3"+CStr(wet)
        elseif power>=3 then
            翻牌 = "2" + CStr(wet)
            else 翻牌= "0"+CStr(wet)
        end if
    elseif straightface>=1 then
        If power >= 10 or power = 9 and card1 <> Lib.德扑数学.四取小(card1, a1, a2, a3) and card2 <> Lib.德扑数学.四取小(card2, a1, a2, a3) or power = 9 and Lib.德扑数学.五取大(card1,card2, a1, a2, a3)=14 and Lib.德扑数学.五取小(card1,card2, a1, a2, a3)=10 or power = 9 and Lib.德扑数学.五取大(card1,card2, a1, a2, a3)=14 and Lib.德扑数学.五取小(card1,card2, a1, a2, a3)=5 and card1<>14 and card2<>14 Then
            翻牌= "6"+CStr(wet)
        elseif power>=7 then
            翻牌= "5"+CStr(wet)
        ElseIf power >= 4 Then
            If card1<=10 and power = 4 Then
                翻牌 = "2" + CStr(wet)
                Else 翻牌 = "4" + CStr(wet)
            End If
        elseif draw>=2 then
            翻牌= "3"+CStr(wet)
        elseif power=3 then
            翻牌 = "2" + CStr(wet)
        ElseIf power = 2 Then
            翻牌 = "1" + CStr(wet)
            else 翻牌= "0"+CStr(wet)
        end if
    else
        if power>=8 and card1 <> Lib.德扑数学.四取小(card1, a1, a2, a3) and card2 <> Lib.德扑数学.四取小(card2, a1, a2, a3) or power>=7 and wet>=2 or power=7 and 翻牌两高张()=1 Then
            翻牌= "6"+CStr(wet)
        elseif power>=6 then
            翻牌= "5"+CStr(wet)
        elseif power>=4 then
            If card1<=10 and power = 4 Then
                翻牌 = "2" + CStr(wet)
                Else 翻牌 = "4" + CStr(wet)
            End If
        elseif draw>=2 then
            翻牌= "3"+CStr(wet)
        elseif power=3 then
            翻牌 = "2" + CStr(wet)
        elseif power=2 then
            翻牌 = "1" + CStr(wet)
            else 翻牌= "0"+CStr(wet)
        end if
    End If
    If prepower = 10 Then
            翻牌 = "0" + CStr(wet)
            dm.WriteFile "排错.txt", " id=" +id+ CStr(session)
    End If
    dm.WriteFile id+".txt", "  翻牌圈牌力=" + CStr(power)
    dm.WriteFile id+".txt", "  翻牌圈听牌=" + CStr(draw)
    dm.WriteFile id+".txt", "  翻牌圈成对牌面=" + CStr(pairface)
    dm.WriteFile id+".txt", "  翻牌圈同花牌面=" + CStr(flashface)
    dm.WriteFile id+".txt", "  翻牌圈湿度=" + CStr(wet)
end function
Function 牌面(a, b, c, x, y, z)
    Dim min,mid2,max,flashface,straightface,pairface,wet
    min = Lib.德扑数学.三取小(a, b, c)
    mid2 = Lib.德扑数学.三取中(a, b, c)
    max = Lib.德扑数学.三取大(a, b, c)
    flashface = 0
    straightface = 0
    pairface = 0
    wet= 0
    if a=b and a=c then
        牌面 = "2000"
        Exit Function
    end if
    if max=mid2 or max=min or mid2=min then
        pairface=1
    end if
    if max-min<=3 or max-min=4 and min>=10 then
        straightface=1
    elseif max-min=4 then
        straightface=2
    end if
    if x=y and y=z then
        flashface=1
    elseif x=y or x=z or y=z then
        flashface=2
    end if
    if pairface=1 then
        if flashface=2 then
            wet=1
            else wet=0
        end if
    elseif flashface=1 and straightface>=1 then
        wet=4
    elseif flashface=1 and straightface=0 then
        wet=3
    elseif flashface=2 and straightface=1 then
        wet=3
    elseif flashface=2 then
        wet=2
    elseif straightface>=1 then
        wet=1
    end if
    牌面= CStr(pairface)+CStr(flashface)+CStr(wet)+CStr(straightface)
end function
function 牌力(c1,c2,r1,r2,a,b,c,x,y,z)
    if Lib.德扑数学.同花(r1,r2,x,y,z)=1 and Lib.德扑数学.顺子(c1,c2,a,b,c)=1 or Lib.德扑数学.四条(c1,c2,a,b,c)=1 then
        牌力 = 12
        ElseIf Lib.德扑数学.带A明三(c1, c2, a, b, c) = 1 Then
        MessageBox "有带A明三"
        牌力= 12
    elseif Lib.德扑数学.葫芦(c1,c2,a,b,c)=1 then
        牌力= 11
    elseif Lib.德扑数学.同花(r1,r2,x,y,z)=1 then
        牌力= 10
    elseif Lib.德扑数学.顺子(c1,c2,a,b,c)=1 then
    返回值 = Lib.德扑翻牌圈.牌力(c1,c2,r1,r2,a,b,c,x,y,z)

        牌力= 9
    elseif Lib.德扑数学.暗三(c1,c2,a,b,c)>=2 then
        牌力= 8
    elseif Lib.德扑数学.暗三(c1,c2,a,b,c)=1 then
        牌力= 7
    elseif Lib.德扑数学.明三(c1,c2,a,b,c)=1 then
        牌力= 5
    elseif Lib.德扑数学.顶两对(c1,c2,a,b,c)=1 then
        牌力= 6
    elseif Lib.德扑数学.中两对(c1,c2,a,b,c)=1 then
        牌力= 5
    elseif Lib.德扑数学.底两对(c1,c2,a,b,c)=1 then
        牌力= 5
    elseif Lib.德扑数学.超对(c1,c2,a,b,c)=1 then
        牌力= 4
    elseif Lib.德扑数学.顶对(c1,c2,a,b,c)=1 then
        牌力= 3
    elseif Lib.德扑数学.中对(c1,c2,a,b,c)=1 then
        牌力= 2
    elseif Lib.德扑数学.底对(c1,c2,a,b,c)=1 then
        牌力= 1
        else 牌力= 0
    End If
    TracePrint "牌力="+CStr(牌力)
End Function



这是按键精灵写的,我想大部分程序员都可以看懂个大概,看起来像是伪代码,实际上就是源码,想要源码的不用私聊我了,不会回,更不会给的。
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏
2#
huluhulu 发表于 2018-8-16 16:06:46 | 只看该作者
看不懂,但觉得很厉害
3#
an son 105 发表于 2018-8-18 15:50:50 来自手机 | 只看该作者
看不懂,但觉得很厉害
4#
 楼主| rxatom 发表于 2018-8-18 21:20:36 | 只看该作者
这部分代码是对自己手牌在翻牌圈的牌力判断,其实大部分机器人程序都比较弱智,程序员的想法很多时候理论上看起来很容易实现,但实际上你写程序的过程中会碰到各种各样的问题,很难把自己的策略都一一实现,所以这种机器人的核心策略都比较简单机械化,跟“冷扑大师”这种人工智能差距太远,打不赢这种机器人肯定是牌手自己的问题。
5#
一条街价值诈频 发表于 2018-8-20 11:08:14 | 只看该作者
再简单的机器人起码不会情绪化,被动严格的遵守纪律··
6#
chenxiaoowen 发表于 2018-8-21 13:18:25 | 只看该作者
流弊。楼主有为平台编过程序吗?
7#
hutgies 发表于 2018-8-23 11:36:06 | 只看该作者
一般平台就算真有机器人也只是为了填桌,打不打得过真人还另说呢,不用太担心这些。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|智游城论坛

GMT+8, 2024-4-20 08:45 , Processed in 0.043291 second(s), 9 queries , Redis On.

Powered by Discuz! X3.2

© 2001-2012 Comsenz Inc.

返回顶部