コード例 #1
0
ファイル: s_quad_table.py プロジェクト: gzvulon/IAI2-LOA
 def movePiece(self, action, state):
     from_x = action.col
     from_y = action.row
     player = state.board[action.row][action.col]
     
     to_y, to_x = findDest(action, state.board, state.size)
     
     capture = False
     if state.board[to_y][to_x] == other_player(player):
         capture = True
         
     self.updateSurroundingCells(from_x, from_y, player)
     self.updateSurroundingCells(to_x, to_y, player)
     if capture:
         self.updateSurroundingCells(to_x, to_y, other_player(player))
コード例 #2
0
 def evaluate(self, state, my_player, info_set):
     enemy = other_player(my_player)
     
     com_mine = self.cm_eval.evaluate(state, my_player, info_set)
     com_his = self.cm_eval.evaluate(state,enemy , info_set)
     
     euler_mine =  self.quad_eval.evaluate(state, my_player, info_set)
     euler_his = self.quad_eval.evaluate(state, enemy, info_set)
     
     if com_mine < self.wanted_mass:
         weight = self.weight_before
     else: 
         weight = self.weight_after
     
     h_mine = (1 - weight) * com_mine + weight * euler_mine
     h_his =  (1 - weight) * com_his + weight * euler_his
     h = h_mine - self.weight_enemy * h_his
     return h 
コード例 #3
0
 def evaluate(self, state, my_player, info_set):
     enemy = other_player(my_player)
     
     com_mine = self.cm_eval.evaluate(state, my_player, info_set)
     com_his = self.cm_eval.evaluate(state,enemy , info_set)
     
     euler_mine =  self.quad_eval.evaluate(state, my_player, info_set)
     euler_his = self.quad_eval.evaluate(state, enemy, info_set)
     
     if com_mine < self.wanted_mass:
         weight = self.weight_before
     else: 
         weight = self.weight_after
     
     h_mine = apply_weight(weight,euler_mine, com_mine)
     h_his =  apply_weight(weight,1-euler_his, com_his)
     
     h = h_mine - self.weight_enemy * h_his
     return h