當前位置: 首頁>>代碼示例>>Python>>正文


Python Rule.refresh方法代碼示例

本文整理匯總了Python中rule.Rule.refresh方法的典型用法代碼示例。如果您正苦於以下問題:Python Rule.refresh方法的具體用法?Python Rule.refresh怎麽用?Python Rule.refresh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rule.Rule的用法示例。


在下文中一共展示了Rule.refresh方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: min

# 需要導入模塊: from rule import Rule [as 別名]
# 或者: from rule.Rule import refresh [as 別名]
def min(brd, aa= -64, depth=10, best=()):
    if depth == 0:
        return ((), calc(brd))
    val = 64
    bestmove = ()
    moves = brd.getMove(brd.w)
    if len(moves) == 0:
       return (bestmove, 64) 
    if best:
        moves.append(best)
    for i in range(len(moves)-1, -1, -1):
        if best and i < len(moves)-1 and moves[i] == best:
            continue;
        w = move(moves[i][0], moves[i][1], brd.w)
        tmp = Brd(brd.b, w)
        Rule.refresh(moves[i][1], tmp.w, tmp.b, tmp)
        response = max(tmp, val, depth - 1, best=())[1]
        if response < aa:
            bestmove = moves[i]
            val = response
            break
        if response < val:
            bestmove = moves[i]
            val = response
    if val == 64: #white lose anyway
        bestmove = moves[0]
    return (bestmove, val)     
開發者ID:coolcooleric,項目名稱:siding,代碼行數:29,代碼來源:value.py

示例2: max

# 需要導入模塊: from rule import Rule [as 別名]
# 或者: from rule.Rule import refresh [as 別名]
def max(brd, bb=64, depth=10, best=()):
    if depth == 0:
        return ((), calc(brd))  
    bestmove = () 
    val = -64  
    moves = brd.getMove(brd.b)
    if len(moves) == 0:
       return (bestmove, -64) 
    if len(best) > 0:
        moves.append(best)
    for i in range(len(moves)-1, -1, -1):
        if best and i < len(moves)-1 and moves[i] == best:
            continue;
        b = move(moves[i][0], moves[i][1], brd.b)
        tmp = Brd(b, brd.w)
        Rule.refresh(moves[i][1], tmp.b, tmp.w, tmp)
        response = min(tmp, val, depth - 1, best=())[1]
        if response > bb:
            bestmove = moves[i]
            val = response
            break;
        if response > val:
            bestmove = moves[i]
            val = response
    if val == -64: #black lose anyway
        bestmove = moves[0]
    return (bestmove, val)
開發者ID:coolcooleric,項目名稱:siding,代碼行數:29,代碼來源:value.py

示例3: moveb

# 需要導入模塊: from rule import Rule [as 別名]
# 或者: from rule.Rule import refresh [as 別名]
def moveb(frm, to, brd):
    brd.b = move(frm, to, brd.b)
    Rule.refresh(to, brd.b, brd.w, brd)
    return brd
開發者ID:coolcooleric,項目名稱:siding,代碼行數:6,代碼來源:main.py

示例4: movew

# 需要導入模塊: from rule import Rule [as 別名]
# 或者: from rule.Rule import refresh [as 別名]
def movew(frm, to, brd): 
    brd.w = move(frm, to, brd.w)
    Rule.refresh(to, brd.w, brd.b, brd)
    return brd
開發者ID:coolcooleric,項目名稱:siding,代碼行數:6,代碼來源:main.py


注:本文中的rule.Rule.refresh方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。