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
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
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
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
def getQueenScore(board): # with depth = 3 return targetedCalculation(board, queens_white_moves, queens_black_moves, queens_getScore, queens_isEnd, 3)