Weight can be configurable
for weight and full heuristic
This commit is contained in:
parent
a1812aaedf
commit
66b10f4deb
2 changed files with 26 additions and 10 deletions
|
@ -18,7 +18,7 @@ class ScoreHeuristicEngine(HeuristicEngine):
|
|||
class WeightHeuristicEngine(HeuristicEngine):
|
||||
|
||||
def get(self, board):
|
||||
score = get_weight(board)
|
||||
score = self.get_weight(board)
|
||||
return score
|
||||
|
||||
def get_weight(self, board):
|
||||
|
@ -42,15 +42,15 @@ class WeightHeuristicEngine(HeuristicEngine):
|
|||
|
||||
# Elements in the corner
|
||||
if pos_x in [0, size -1] and pos_y in [0,size - 1]:
|
||||
w[pos_x][pos_y] = self.weight[2]
|
||||
w[pos_x][pos_y] = self.options['weight'][2]
|
||||
|
||||
# Elements on the border
|
||||
elif pos_x in [0, size -1] or pos_y in [0, size -1]:
|
||||
w[pos_x][pos_y] = self.weight[1]
|
||||
w[pos_x][pos_y] = self.options['weight'][1]
|
||||
|
||||
# Element the center
|
||||
elif pos_x in range( center - padding, center + padding) and pos_y in range(center - padding, center + padding):
|
||||
w[pos_x][pos_y] = self.weight[0]
|
||||
w[pos_x][pos_y] = self.options['weight'][0]
|
||||
return w
|
||||
|
||||
class FullHeuristicEngine(WeightHeuristicEngine):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue