MCPcopy Create free account
hub / github.com/ActiveState/code / EvalBoard

Function EvalBoard

recipes/Python/580698_Reversi_Othello/recipe-580698.py:73–84  ·  view source on GitHub ↗
(board, player)

Source from the content-addressed store, hash-verified

71minEvalBoard = -1 # min - 1
72maxEvalBoard = n * n + 4 * n + 4 + 1 # max + 1
73def EvalBoard(board, player):
74 tot = 0
75 for y in range(n):
76 for x in range(n):
77 if board[y][x] == player:
78 if (x == 0 or x == n - 1) and (y == 0 or y == n - 1):
79 tot += 4 # corner
80 elif (x == 0 or x == n - 1) or (y == 0 or y == n - 1):
81 tot += 2 # side
82 else:
83 tot += 1
84 return tot
85
86# if no valid move(s) possible then True
87def IsTerminalNode(board, player):

Callers 11

GetSortedNodesFunction · 0.85
MinimaxFunction · 0.85
AlphaBetaFunction · 0.85
AlphaBetaSNFunction · 0.85
NegamaxFunction · 0.85
NegamaxABFunction · 0.85
NegamaxABSNFunction · 0.85
NegascoutFunction · 0.85
NegascoutSNFunction · 0.85
BestMoveFunction · 0.85
recipe-580698.pyFile · 0.85

Calls 1

rangeFunction · 0.85

Tested by

no test coverage detected