示例#1
0
def passedPawns(board):
    A = {}
    
    ## first run the remove pawn check --> should deal with many simpler cases.


    ## Then just run the targeted calculation and get an answer. That should take
    ## care of dealing with easy cases by doing the isEnd quickly.
    
    ## check basic drawing cases:
      
    
    T = testEasyDraw(board)
    if T[0]:
        return T[1]
       
        
    ## --> 

    score = targetedCalculation(board, passed_white_moves, passed_black_moves, passed_getScore, passed_isEnd)
    
    if score > 0:
        A['calculate winning'] = 1
    if score < 0:
        A['calculate drawing'] = 1

    return A
示例#2
0
def calculate_below5(board):

    
    # test if the piece exists:
    
    # let's say this returns -1 or 1 based on draw or win. Then we can
    # check it with flipped boards, and then decide if it's a draw or win.
    # depth could be the distance of K from P + 2 or something? Or just
    # put up something even bigger.
    score = targetedCalculation(board, white_moves, black_moves, getScore, isEnd_samefileP)
    return score
示例#3
0
def feature_test(board):

    # test if the piece exists:

    # let's say this returns -1 or 1 based on draw or win. Then we can
    # check it with flipped boards, and then decide if it's a draw or win.
    # depth could be the distance of K from P + 2 or something? Or just
    # put up something even bigger.
    score = targetedCalculation(board, white_moves, black_moves, getScore,
                                isEnd_samefileP, 5)
    print score
示例#4
0
def adjacentPawns(board):
    
    A = {}
    
    score = targetedCalculation(board, adjacent_white_moves, adjacent_black_moves, adjacent_getScore, adjacent_isEnd)
    
    if score > 0:
        A['calculate winning'] = 1
    if score < 0:
        A['calculate drawing'] = 1

    return A
示例#5
0
def getQueenScore(board):
      
    # with depth = 3
    return targetedCalculation(board, queens_white_moves, queens_black_moves, queens_getScore, queens_isEnd, 3)