Пример #1
0
 def __call__(self, x):
     """ If a module is given, wrap it into a ModuleDecidingAgent before evaluating it. 
     Also, if applicable, average the result over multiple games. """
     if isinstance(x, Module):
         agent = ModuleDecidingPlayer(x, self.env, greedySelection = True)
     elif isinstance(x, GomokuPlayer):
         agent = x
     else:
         raise NotImplementedError('Missing implementation for '+x.__class__.__name__+' evaluation')
     res = 0
     agent.game = self.env
     self.opponent.game = self.env
     for dummy in range(self.averageOverGames):
         agent.color = -self.opponent.color
         res += EpisodicTask.__call__(self, agent)            
     return res / float(self.averageOverGames)
Пример #2
0
 def __call__(self, x):
     """ If a module is given, wrap it into a ModuleDecidingAgent before evaluating it. 
     Also, if applicable, average the result over multiple games. """
     if isinstance(x, Module):
         agent = ModuleDecidingPlayer(x, self.env, greedySelection=True)
     elif isinstance(x, GomokuPlayer):
         agent = x
     else:
         raise NotImplementedError('Missing implementation for ' +
                                   x.__class__.__name__ + ' evaluation')
     res = 0
     agent.game = self.env
     self.opponent.game = self.env
     for dummy in range(self.averageOverGames):
         agent.color = -self.opponent.color
         res += EpisodicTask.__call__(self, agent)
     return res / float(self.averageOverGames)